FE-674: Invalidate entity queries after edge apply#126
Conversation
`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.
PR SummaryLow Risk Overview Also updates Reviewed by Cursor Bugbot for commit 54b68d4. Bugbot is set up for automated code reviews on this repo. Configure here. |
🤖 Augment PR SummarySummary: Fixes stale relationships after applying staged edge patches by invalidating the entity React Query caches used by the structured list and graph views. 🤖 Was this summary useful? React with 👍 or 👎 |
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
makeEdgeApplierpersists the edge but never invalidates theentities/entitiesProjectWidecaches that back the structured list and graph view. The siblingmakeEditApplieralready invalidates — edges were the only patch kind that fell through.How
invalidateEntityQueriesAfterEdit→invalidateEntityQueries(now reused for edges).makeEdgeApplieraftercreated: true/alreadyExisted: true, and in undo after the delete.Test plan
npm run verifygreen locally