Fix notebook plotly remount crash - #854
Merged
Merged
Conversation
cristian-tamblay
approved these changes
Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When two notebooks contained the same type of explorer (e.g. two correlation heatmaps) in the same list position, switching between notebooks (or deleting/reordering an item within a single notebook's explorer list) crashed the app with
Uncaught runtime errors: Something went wrong with axis scalinginside Plotly'sdrawColorBar. Neither the notebook view nor its virtualized list gave React a stable identity per notebook/item, so React reused the same<Plot>DOM instance across structurally different figures instead of unmounting/remounting it. Plotly's incrementalPlotly.react()update path can't safely patch a plot div's internal axis/colorbar state across genuinely different figures, which triggered the crash. Adding properkeys forces a clean remount whenever the underlying notebook or list item actually changes, so each figure always gets a fresh Plotly instance.Type of Change
Check all that apply like this [x]:
Changes (by file)
DashAI/front/src/components/notebooks/dataset/DatasetsCenterContent.jsx: addedkey={selectedNotebookId}to<NotebookVisualization>so switching notebooks fully remounts the notebook subtree (including all explorer plots) instead of reusing the previous notebook's component instances.DashAI/front/src/components/notebooks/notebook/NotebookView.jsx: addedcomputeItemKey={(index, item) => \${item.type}-${item.id}`}to theVirtuoso` list so explorer/converter rows are identified by their actual id instead of by list position, preventing component/Plot reuse when items are deleted or reordered.Testing