Repository navigation
fix(query): keep the previous result when .suspend() changes key with placeholderData - #3
Open
Moon-DaeSeung wants to merge 2 commits into
Open
Moon-DaeSeung wants to merge 2 commits into
Moon-DaeSeung wants to merge 2 commits into
Conversation
… placeholderData With placeholderData (e.g. keepPreviousData), a selector .suspend(arg) whose argument changes now keeps the resource's current result visible with isFetching: true and loads the new key after commit, instead of suspending to the boundary fallback. Without placeholderData a new key still suspends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Oct 30, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Oct 30, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Oct 30, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Oct 30, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Oct 31, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Oct 31, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moon-DaeSeung
added a commit
to comwit/template
that referenced
this pull request
Nov 2, 2026
List pages change the model page/filter through their actions and dim the list with the query's isFetching; the queries' placeholderData keeps the current list visible (with @comwit/state including comwit/state#3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
placeholderData: keepPreviousDataonly worked for.load()and imperative.query(). When a selector.suspend(arg)changed its argument (for example, paging withs.items.suspend({ page: s.page })), the new key had no result yet.prepareSuspendthen staged a request and suspended, so the boundary fell back to its skeleton on every page change. The option was ignored on this path.Fix
accessor.ts:readSuspendPlaceholder(key)reports when a not-yet-loaded key is requested over a resource that already shows another key's result and has an effectiveplaceholderData(from the field or the provider defaults). In that caseprepareSuspenddoes not suspend.commitSuspendthen loads the key after commit through the normalexecuteQuerypath, which already appliesplaceholderData. While that request is in flight, the active key is not suspended again.select.ts: for such a key, the selector returns the current result withplaceholderDataapplied,isLoading: falseandisFetching: true.placeholderData, a new key still suspends exactly as before. First loads, SSR streaming and hydration are unchanged.Tests
keepPreviousData keeps the previous result visible instead of suspending. The page change shows no fallback, keeps the old items withisFetching: true, swaps to the new items after the response, and makes no duplicate request.without placeholderData a new argument still suspends.vitest run: 38 files, 489 tests pass.tsc -p tsconfig.jsonandtsc -p tsconfig.type-tests.jsonpass.🤖 Generated with Claude Code