Skip to content

FE-674: Invalidate entity queries after edge apply#126

Open
kostandinang wants to merge 1 commit into
ka/fe-674-card-6-agent-client-uifrom
ka/fe-674-edge-apply-invalidate
Open

FE-674: Invalidate entity queries after edge apply#126
kostandinang wants to merge 1 commit into
ka/fe-674-card-6-agent-client-uifrom
ka/fe-674-edge-apply-invalidate

Conversation

@kostandinang
Copy link
Copy Markdown
Contributor

@kostandinang kostandinang commented May 11, 2026

What

Fixes a bug: in side-chat edit mode, when the agent proposes new relations and the user clicks Apply, the new relations didn't appear until a full reload.

Stacked on #124.

Root cause

makeEdgeApplier persists the edge but never invalidates the entities / entitiesProjectWide caches that back the structured list and graph view. The sibling makeEditApplier already invalidates — edges were the only patch kind that fell through.

How

  • Rename invalidateEntityQueriesAfterEditinvalidateEntityQueries (now reused for edges).
  • Call it in makeEdgeApplier after created: true / alreadyExisted: true, and in undo after the delete.

Test plan

  • npm run verify green locally
  • Ask the agent to relate the pinned item to others; click Apply; new relations appear without reload
  • Undo removes them without reload

`makeEdgeApplier` POSTed the edge to the server but never invalidated
the `entities` / `entitiesProjectWide` React Query caches that back the
structured-list and graph views. The new relation was persisted but did
not appear in the UI until a full page reload — visible most often when
the side-chat (edit mode) proposes `propose_edge` patches via "relate to
new items" and the user clicks Apply.

`makeEditApplier` already invalidates after content writes; edges were
the only patch kind that fell through that gap. Annotations refresh via
the side-chat-host effect keyed on `lastBatchId`, so they were unaffected.

Rename the shared helper to `invalidateEntityQueries` and call it after
the create succeeds (covering both the `created: true` and
`alreadyExisted: true` branches) plus inside the undo after the delete
succeeds — mirroring the edit applier's invalidation surface.
@cursor
Copy link
Copy Markdown

cursor Bot commented May 11, 2026

PR Summary

Low Risk
Low risk: small client-side cache invalidation changes after edge create/delete; main risk is extra refetches or missed invalidation paths.

Overview
Fixes stale relationship UI after applying edge patches by reusing a renamed invalidateEntityQueries helper and calling it from makeEdgeApplier after successful edge create (including the alreadyExisted path) and after undo delete.

Also updates makeEditApplier to use the renamed helper, keeping entity/relationship refetch behavior consistent after applies and undos.

Reviewed by Cursor Bugbot for commit 54b68d4. Bugbot is set up for automated code reviews on this repo. Configure here.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 11, 2026

🤖 Augment PR Summary

Summary: Fixes stale relationships after applying staged edge patches by invalidating the entity React Query caches used by the structured list and graph views.
Changes: Renames the entity invalidation helper and reuses it in makeEdgeApplier after successful create (including already-existed) and after undo delete so edges appear/disappear without a full reload.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

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