Selecting a class goes straight to its highlight - #534
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
WaylandYang
force-pushed
the
fix/revealing-a-class-does-not-rebuild
branch
from
September 9, 2026 07:50
5385a3a to
c59845b
Compare
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.
Click a class in the ontology rail that is not currently drawn, and the diagram
flickers: for one frame every node and edge lights up at full brightness, then
everything dims to the new selection. On a dense canvas that reads as a white
flash.
Measured on one node, sampling sigma's own
afterRender, before the fix. Class Awas already selected, then class B was clicked:
Two causes, one symptom
The reducer silently downgrades "selected but not drawn yet" to "nothing
selected." Its guard is
sel.kind === "class" && g.hasNode(sel.id). Clicking anundrawn class reveals it asynchronously, so for one render
hasNodeis false andthe whole graph comes up unlit. Opening the detail panel shrinks the canvas at the
same moment, forcing exactly that repaint, which is why it is so visible.
Fixed by holding the selection until the class is actually in the graph. The canvas
keeps the previous highlight for those ~30ms and then switches once, cleanly.
Revealing a class rebuilt the entire renderer.
reveal()changes the drawnscope, which recomputes the graph, which tore down Sigma and built a new one — seven
canvases destroyed and recreated, GPU buffers, camera, hover and selection state all
thrown away, plus a fresh first frame. The camera restarted from its default fit,
so the view jumped to "see everything" and then panned to the target.
Fixed by splitting the two lifecycles. The graph is now a single persistent instance
that new content is merged into (
syncGraphingraphCanvas.ts; graphology emitsevents and Sigma listens, so in-place mutation is the supported path). The renderer
is built once. Measured after: zero canvas churn, same graph and renderer
objects, node count 44 → 45, camera untouched at
0.340, 0.660, r=0.42.Three values the renderer closes over (
onSelect,relationById) moved to refs,since the effect no longer re-runs.
Also here
Selecting a property whose Subject and Object are both "Any type" — there are 184
of them in a schema.org knowledge base, and the legend already counts them —
dimmed the entire diagram and lit nothing, because the endpoint set is empty and
every node fell into the "not part of the selection" branch. It read as "I selected
it and it broke." Now the canvas simply does not react; the panel already says
Subject and Object are Any type. Scoped properties are unaffected:
aboutstilldims 43 nodes and thickens its edges.
Not the same as #532
That one makes the blur on a glass panel arrive on the same schedule as its opacity.
It is a real defect and worth keeping, but it is not the cause of the flash
reported here — this is.
Conflicts
Touches
OntologySchemaGraph.tsx, which #529 also touches. Whichever lands secondwill need a small merge.
Checked
pnpm buildclean; style guard 46/46.preserved (verified by spying on
camera.animate; the animation itself cannot beobserved in the headless preview pane, which does not run rAF).
full size, non-neighbours muted, panel titled correctly.
🤖 Generated with Claude Code