fix(memory-graph): keep node selection when pagination changes the node count#1263
Open
abhay-codes07 wants to merge 1 commit into
Open
fix(memory-graph): keep node selection when pagination changes the node count#1263abhay-codes07 wants to merge 1 commit into
abhay-codes07 wants to merge 1 commit into
Conversation
…ount The slideshow effect depends on nodes.length and its inactive branch unconditionally cleared the selected node. With the slideshow off (the default), any change in node count re-ran the effect and wiped the user's selection: pin a node's popover, zoom out far enough for the load-more trigger to append a page of documents, and the popover vanishes mid-read. The reset also fired a stray coolDown() on the simulation. Track the previous slideshow state in a ref and only clear the selection on a real active -> inactive transition.
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.
What
Pin a node's popover in the memory graph, zoom out far enough for the load-more trigger to fetch the next page, and the popover vanishes mid-read.
The slideshow effect in
memory-graph.tsxdepends onnodes.length, and its inactive branch unconditionally cleared the selected node:With the slideshow off (the default for every consumer), any change in node count re-ran the effect and wiped the user's selection — pagination appending documents being the common trigger. It also fired a stray
coolDown()on the simulation each time.Fix
Track the previous slideshow state in a ref and only clear the selection on a genuine active → inactive transition. Re-runs caused by
nodes.lengthchanging while the slideshow was never active are now no-ops.Testing
bun run testinpackages/memory-graph— 188 passbun run check-types— cleanBehaviour notes for review: the active → inactive transition still clears the selection and cools the simulation exactly as before; the only change is that re-runs where the slideshow was never active no longer touch the selection.