perf(ui): align React Query cache between memory grid and graph#845
Open
ishaanxgupta wants to merge 1 commit intosupermemoryai:mainfrom
Open
perf(ui): align React Query cache between memory grid and graph#845ishaanxgupta wants to merge 1 commit intosupermemoryai:mainfrom
ishaanxgupta wants to merge 1 commit intosupermemoryai:mainfrom
Conversation
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.
Summary
Aligns the React Query caching strategy for the
@post/documents/documentsendpoint between the main Memory Grid and the Memory Graph UI.Previously,
use-graph-api.tsused a completely differentqueryKey(["graph-documents", ...]) and a shortstaleTimeof 30 seconds, whilememories-grid.tsxcached the same payload for 5 minutes under["documents-with-memories", ...].This mismatch resulted in the client ignoring its cache and blindly re-fetching identical document arrays when the user toggled the graph view, wasting network bandwidth and blocking the main thread on parsing duplicate JSON.
Changes
queryKeyinapps/web/components/memory-graph/hooks/use-graph-api.tsto["documents-with-memories", containerTags, []].staleTimefrom 30s to 5m to mirror the grid cache configuration.Impact