Skip to content

fix(memory-graph): keep node selection when pagination changes the node count#1263

Open
abhay-codes07 wants to merge 1 commit into
supermemoryai:mainfrom
abhay-codes07:fix/graph-slideshow-selection-wipe
Open

fix(memory-graph): keep node selection when pagination changes the node count#1263
abhay-codes07 wants to merge 1 commit into
supermemoryai:mainfrom
abhay-codes07:fix/graph-slideshow-selection-wipe

Conversation

@abhay-codes07

Copy link
Copy Markdown
Contributor

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.tsx depends on nodes.length, and its inactive branch unconditionally cleared the selected node:

useEffect(() => {
    if (!isSlideshowActive || nodes.length === 0) {
        if (!isSlideshowActive) {
            setSelectedNode(null)   // runs on every node-count change
            ...

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.length changing while the slideshow was never active are now no-ops.

Testing

  • bun run test in packages/memory-graph — 188 pass
  • bun run check-types — clean

Behaviour 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.

…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.
Copilot AI review requested due to automatic review settings July 12, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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