-
Notifications
You must be signed in to change notification settings - Fork 359
Description
Description
When using vis-timeline with nested items (items grouped within a parent item, often via the subgroup property) and clustering enabled, expanding a nested group that contains a clustered item in the current view timeframe causes a critical rendering error.
When the nested items are collapsed (not visible), the timeline functions normally.
When the nested items are expanded (visible) and there is a cluster representing multiple items within the currently visible timeframe, an error is thrown in the console, and the nested items fail to draw correctly.
Steps to Reproduce
Set up a vis-timeline instance with:
Clustering enabled.
Nested groups/items where the parent item uses a group and the child items use a subgroup.
Ensure there are items within the nested group that would naturally form a cluster at a wider zoom level (e.g., in the '2mo' view).
Set the zoom level to a wider view (e.g., 2 months), where clustering is active. (See image_4b3c55.png - No nested items visible, cluster visible).
Expand the nested item group.
The console error occurs, and the nested items are not drawn in the timeline. (See image_4b3c1e.png - Nested items not drawn after expanding).
If you then zoom in to a narrower view (e.g., 1 week) where the cluster is dissolved and individual items are shown, the nested items draw correctly. (See image_4b3f25.png - Nested items drawn correctly at 1w zoom).
If you zoom back out to the wider view with the nested items still expanded, the issue persists.
Expected Behavior
The nested items should render correctly whether they are part of a cluster or not when their parent group is expanded, without throwing a console error.
Observed Behavior (Console Error)
The following error is observed in the console:
_Uncaught vis-timeline esnext.js?v=ebb2e53f:9070 t Error: Cannot redraw item: no parent attached
at vis_timeline_esnext.js?v=ebb2e53f:9070:13
at vis_timeline_esnext.js?v=ebb2e53f:6937:17
at Object.forEach (chunk-ILPR5XXV.js?v=6afb4d08:2353:9)
at Group._updateClustersInRange (vis_timeline_esnext.js?v=ebb2e53f:6936:24)
at getVisibleItems (vis_timeline_esnext.js?v=ebb2e53f:6315:38)
at Group.redrawItems (vis_timeline_esnext.js?v=ebb2e53f:6342:29)
at Array. (vis_timeline_esnext.js?v=ebb2e53f:6436:37)
at vis_timeline_esnext.js?v=ebb2e53f:10185:39
at Object.forEach (chunk-ILPR5XXV.js?v=6afb4d08:2353:9)
at ItemSet.redraw (vis_timeline_esnext.js?v=ebb2e53f:10184:24)
The error suggests a redrawing issue where an item that is part of a cluster doesn't have its required parent DOM element when the timeline tries to update the clusters in range after the items become visible (by expanding the nested group).
Technical Details
vis-timeline Version: ^7.7.4
Browser: Chrome, Firefox, Edge
state when initially expanded and no clusters:

state when initially expanded and clusters:

state when initially not expanded, then expanded and clusters (nested item is not redrawn):
