Virtual scrolling
No configuration is needed. The chart and grid virtualise both rows (vertical) and time cells (horizontal) automatically. You will not notice a difference in the component API whether you have 50 tasks or 50,000.The 10,000-task performance demo renders and measures the initial paint time on the client. See the live demo for an interactive benchmark.
Lazy loading with the lazy flag
For very deep task hierarchies you can defer loading children until a summary task is expanded. Set lazy: true on any task that has children not yet included in the initial dataset.
request-data event with the expanded task’s id. Respond by fetching the children and calling api.exec('provide-data', ...) to insert them:
Server-side data loading with RestDataProvider
@svar-ui/gantt-data-provider ships a RestDataProvider that handles the full CRUD + lazy-load cycle over a REST API. Connect it via api.setNext() so all Gantt actions (add, update, delete, lazy expand) are automatically synced to the server.
Install the data provider
RestDataProvider is bundled as a dependency of @svar-ui/react-gantt. Import it directly:Batched REST updates
To reduce the number of HTTP requests when many actions fire in quick succession, pass abatchURL option to RestDataProvider. All queued mutations are sent in a single batch request.
Manual server sync (without RestDataProvider)
If you need full control over how changes are sent to the server, useapi.on() to handle each action type:
Best practices
Keep the initial task list shallow
Keep the initial task list shallow
Load only the top-level tasks and their immediate children on first render. Mark deeper summary tasks with
lazy: true and load their children on demand via request-data.Parse dates on the server boundary
Parse dates on the server boundary
The Gantt expects
Date objects, not strings. Parse start and end to Date in the same place you receive server data — before passing to tasks prop or provide-data.Use useMemo for tasks and links
Use useMemo for tasks and links
Avoid creating new
tasks or links arrays on every render. Wrap them in useMemo or store them in state so the Gantt’s internal reconciliation can skip unnecessary reprocessing.Use RestDataProvider for CRUD sync
Use RestDataProvider for CRUD sync
RestDataProvider with batchURL reduces HTTP round-trips and handles the lazy-load protocol automatically. Prefer it over manually wiring api.on() handlers unless you need custom request shapes.Enable undo only when needed
Enable undo only when needed
The
undo={true} prop on <Gantt> keeps a full history buffer in memory. Disable it on read-only charts or dashboards where undo is not required.