Skip to content

Application State And Persistence

Your application owns persisted project data. Gantt owns scheduling, validation, projection, and supported local mutations while the grid is mounted.

Keep these collections together as one logical project snapshot:

  • source: authored task rows.
  • ganttDependencies.
  • ganttCalendars.
  • ganttResources.
  • ganttAssignments.
  • ganttBaselines.
  • gantt: project metadata and behavior configuration.

When a server response or collaborative update arrives, replace affected arrays and assign a new gantt object when configuration changed. Do not mutate an existing array in place and expect framework or custom-element change detection to observe it.

function applyProject(snapshot: ProjectSnapshot) {
grid.gantt = { ...snapshot };
grid.ganttCalendars = [...snapshot.calendars];
grid.ganttDependencies = [...snapshot.dependencies];
grid.ganttResources = [...snapshot.resources];
grid.ganttAssignments = [...snapshot.assignments];
grid.ganttBaselines = [...snapshot.baselines];
grid.source = snapshot.tasks.map(toSourceRow);
}
  1. Listen for the Gantt before-change events when the application needs authorization or validation.
  2. Allow Gantt to commit supported local mutations.
  3. Read the current project through the GanttPlugin instance or the application state updated by your integration.
  4. Persist a complete snapshot or an application-defined patch.
  5. Replace the public collections with the canonical server result when the server normalizes data.

Use JSON project helpers for snapshots and integration recipes for REST, GraphQL, PostgreSQL, and Supabase-style persistence.

  • Use stable entity IDs across every collection.
  • Version project writes in your backend and reject stale updates.
  • Re-run scheduling after dependency, calendar, task, resource, or assignment updates.
  • Keep optimistic rollback data outside the rendered DOM.
  • Use gantt.readOnly while a project is locked or awaiting approval.

See Events And Methods for cancelable events and plugin access.