Skip to content

Fall back to force layout when the callback graph's dagre layout fails - #4166

Open
T4rk1n wants to merge 2 commits into
devfrom
fix/callback-graph-layout-crash
Open

T4rk1n wants to merge 2 commits into
devfrom
fix/callback-graph-layout-crash

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Opening the callback graph in dev tools crashes on some apps with Cannot set properties of undefined (setting 'order') (Firefox: can't access property "order", g.node(...) is undefined), and the panel shows "Oops! The callback graph threw an error." Found on the Dash docs app (598 callbacks).

The error comes from dagre 0.8.5 itself, on some graph shapes. It isn't new in 4.5: dagre and the tight-tree ranker haven't changed since 2020. Switching rankers doesn't help: longest-path hits the same error, and network-simplex throws a different one on the docs graph.

The layout now runs in an effect instead of through CytoscapeComponent's layout prop, so a failure can be caught. When dagre throws, the graph is laid out with fcose (force) and a short note says the chosen layout failed. Saved positions and the layout selector work as before.

test_dvui008 reproduces it with 8 callbacks reduced from the docs app. It fails on 4.5.1 and passes with this change. The other test_devtools_ui.py tests still pass.

dagre 0.8.5 throws "Cannot set properties of undefined (setting 'order')"
on some graph shapes (seen on the Dash docs app, 598 callbacks), which
replaced the whole callback graph with an error. Run the layout ourselves
instead of through CytoscapeComponent's layout prop, catch the failure,
lay out with fcose and show a short note.
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Dash performance benchmarks

⚠️ regressions to review

scenario metric p90 (ms) median growth baseline p90 note
⚠️ initial_render_small render_ms 169.3 106.7 0.96x 104.0 1.5x baseline (norm)
✅ callback_chain chain_ms 487.2 469.9 0.92x 499.1
✅ callback_chain graph_ms 2.6 2.6 1.0x 2.4
✅ callback_fanout fanout_ms 104.8 81.8 0.85x 92.5
✅ deep_nesting render_ms 58.5 54.1 0.99x 56.8
✅ full_children_replace replace_ms 179.4 107.2 2.81x -
✅ initial_render_large render_ms 713.8 623.9 0.92x 694.4
✅ patch_append_nested append_ms 143.0 99.0 2.39x 192.3
✅ patch_append_toplevel append_ms 137.2 103.1 2.39x 140.2
✅ patch_scalar_update_large update_ms 163.9 153.2 0.99x 202.9
✅ rerender_existing_subtree rerender_ms 127.8 114.6 1.03x -
✅ wildcard_all_resolve wildcard_ms 324.4 310.2 0.94x 313.6
✅ wildcard_all_resolve graph_ms 1.3 1.3 1.0x 1.3

growth = late-third / early-third per-op time; ~1 is flat, a large value means the per-op cost scales with accumulated state.

machine scale vs baseline: 1.11x - divided out of the baseline ratios so they compare like for like (the absolute warn/fail ceilings are left un-scaled); calibrated on initial_render_small.

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant