Skip to content

Fix notebook plotly remount crash - #854

Merged
cristian-tamblay merged 2 commits into
developfrom
fix/notebook-plotly-remount-crash
Sep 1, 2026
Merged

Fix notebook plotly remount crash#854
cristian-tamblay merged 2 commits into
developfrom
fix/notebook-plotly-remount-crash

Conversation

@Creylay

@Creylay Creylay commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

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 scaling inside Plotly's drawColorBar. 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 incremental Plotly.react() update path can't safely patch a plot div's internal axis/colorbar state across genuinely different figures, which triggered the crash. Adding proper keys 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]:

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • DashAI/front/src/components/notebooks/dataset/DatasetsCenterContent.jsx: added key={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: added computeItemKey={(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

  • Created two notebooks with the same explorer type (same position in each list) and switched between them. No crash and each plot renders correctly.
  • Within a single notebook, added two explorers of the same type with structurally different figures and deleted the first one to shift list positions.

@cristian-tamblay
cristian-tamblay merged commit 7c1a0d6 into develop Sep 1, 2026
21 checks passed
@cristian-tamblay
cristian-tamblay deleted the fix/notebook-plotly-remount-crash branch September 1, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants