| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: deb1723d-d4d8-4a0c-a6e8-03376d1f7585 📥 CommitsReviewing files that changed from the base of the PR and between 0fe34b4 and 97c514a. 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 Walkthrough WalkthroughThe Preact query hooks now disable optimistic fetching and observer subscriptions when subscribed: false. Tests cover query execution, observer counts, and idle fetch state. A patch changeset records the fix. ChangesPreact subscription behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 97c51 This change prevents unsubscribed queries from reporting a fetch that never occurs and keeps subscription toggles consistent; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: sukvvon, tkdodo 🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
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. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem
subscribed: false is broken in @tanstack/preact-query. A hook that opts out of subscribing still reports isFetching: true / fetchStatus: 'fetching' on first render, even though no observer is ever attached and the queryFn is never called.
The Preact adapter was forked from React in #9935 (Feb 2026) and then missed two fixes that landed on the React side afterwards:
Both hooks in preact-query still set _optimisticResults = 'optimistic' unconditionally. In createResult, that branch computes fetchOnMount = !mounted && shouldFetchOnMount(query, options); with no listeners attached, mounted is false and the result is optimistically flipped into fetchState — a fetch that will never happen. useQueries additionally left subscribed out of the useMemo dependency array, so toggling it did not recompute the defaulted options.
Fix
Port the two upstream changes verbatim: derive subscribed once, use it to gate _optimisticResults (undefined when not subscribed), add it to the useQueries dependency array, and reuse it for shouldSubscribe. The diff is identical in shape to react-query's current useBaseQuery.ts / useQueries.ts.
Tests
Two regression tests, mirroring the ones added upstream:
Both are synchronous, so there is no timer race.
Validation
Run from the repo root with pnpm nx run @tanstack/preact-query:test:lib --skip-nx-cache.
Summary by CodeRabbit
Bug Fixes
Tests