fix(solid-query): prevent suspense trigger with pre-cached data#10052
fix(solid-query): prevent suspense trigger with pre-cached data#10052shinseongsu wants to merge 1 commit intoTanStack:mainfrom
Conversation
When using `refetchOnMount: false` with pre-cached data, the first `setQueryData` call would incorrectly trigger a Suspense fallback. This happened because the Proxy handler was calling `queryResource()` even when cached data was available. This fix ensures that: 1. The resource resolves immediately when data is already available, regardless of the `isLoading` state 2. The Proxy handler returns cached data directly when `isFetching` is false and data exists, avoiding unnecessary resource access Closes TanStack#9883 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughIntroduces a test case verifying that suspense is not triggered when Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
When using
refetchOnMount: falsewith pre-cached data, the firstsetQueryDatacall would incorrectly trigger a Suspense fallback. This happened because the Proxy handler was callingqueryResource()even when cached data was available.This fix ensures that:
isLoadingstateisFetchingis false and data exists, avoiding unnecessary resource accessIssue #9883
Changes
Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
refetchOnMountdisabled.Tests
✏️ Tip: You can customize this high-level summary in your review settings.