Repository navigation
Conversation
🦋 Changeset detectedLatest commit: 8a21fac The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
|
View your CI Pipeline Execution ↗ for commit 8a21fac
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview24 package(s) bumped directly, 2 bumped as dependents. 🟥 Major bumps
🟨 Minor bumps
|
React Query bundle sizeGzipped Query runtimeEach row compares the Query JavaScript used by the same app. The change is measured against v6 for that row. Negative values mean fewer bytes.
The pluggable read-only list retains the query client, cache, query and observer. Its production build drops the Suspense builder and policy, mutation cache and observer, polling scheduler, infinite-query behavior, selection, placeholder data, serial scopes and bulk cache operations. Both bookmark apps retain the mutation cache and observer. Baseline adapter and core at Query runtime sizes · minified JS, gzip and BrotliThe app entry drives tree-shaking. This build externalizes React and React DOM and groups the adapter and its retained query-core modules into one ESM chunk for each package. Each cell measures the isolated chunk directly.
Largest modules in the read-only pluggable chunk, by rendered size before minification: Whole production app sizes · minified JS, gzip and BrotliEach build includes the app, React, React DOM and Query. This measures the JavaScript delivered to the browser.
All sizes are bytes. Each JavaScript chunk is compressed separately with gzip level 9 and Brotli quality 11, then summed. |
size-limit report 📦
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…rom a shared-core adapter
🎯 Changes
I want a screen that reads one query to pay for the code that read needs. This draft adds
@tanstack/react-query-pluggable, an ESM adapter for React 19. It shares retry, cancellation, garbage collection, state helpers and environment managers with@tanstack/query-core. Optional observers, cache operations and polling enter the bundle through the imports that use them. The comparison uses the unchanged@tanstack/react-queryfrom thequery-v6base.ESM gives bundlers a static import graph, but methods on a constructed class can keep features reachable. I’m comfortable asking users to migrate to separate named imports when the app actually drops those implementations. I expect TypeScript and AI-assisted development to make more distributed APIs easier to find and migrate. That is a design assumption. The measurements below test the payload savings.
One hook, four query modes
Create a
QueryClientand pass it toQueryClientProviderfrom the same package. A caller can choose how eachuseQueryinvocation reads its data. Herepostcontains a query key and fetch function.pagesalso suppliesinitialPageParamandgetNextPageParam.@tanstack/react-query@tanstack/react-query-pluggableuseQuery(post)useQuery(query(post))useSuspenseQuery(post)useQuery(suspenseQuery(post))useInfiniteQuery(pages)useQuery(infiniteQuery(pages))useSuspenseInfiniteQuery(pages)useQuery(suspenseQuery(infiniteQuery(pages)))queryis the same JavaScript function asqueryOptions.useQuery(post)still works. The paginated result exposesdata.pages,hasNextPageandfetchNextPage. Wrapping the options insuspenseQuerylets the nearest Suspense boundary handle an uncached read and the nearest error boundary handle a failed fetch without cached data. The dedicated hooks remain available. Both readers of the same query key use the same cached data.Move client operations to named imports
QueryClientholds the caches, defaults and lifecycle state. Every operation on that client is a named export with the client as its first argument. Creating a client foruseQuerycan therefore leave out imperative fetching, writes and bulk invalidation.Before, on
query-v6With the pluggable adapter
Defaults follow the same convention, for example
setQueryDefaults(client, key, options). The provider handles mount and unmount. Integrations that manage a client directly usemountQueryClient(client),unmountQueryClient(client)andclearQueryClient(client).Cache objects keep their own methods.
getMutationCache(client).subscribe(listener)creates a cache on first access or returns the constructor-supplied cache.useMutationacquires the same cache automatically. The stock@tanstack/query-persist-client-coresubscription callsclient.getQueryCache()andclient.getMutationCache()on the instance. A persistence integration for this adapter must use the named accessors and the adapter'shydrateanddehydrate.Import option behavior where it is used
refetchInterval: 3000refetchInterval: refetchInterval(3000)select: (post) => post.titleselect: [select, (post) => post.title]placeholderData: keepPreviousDataplaceholderData: placeholderData(keepPreviousData)scope: { id: 'orders' }scope: serialScope('orders')The tuple preserves inline selector inference. An already typed selector can use
select: select(getTitle). Mutations with the same scope ID run in order within a cache, including after dehydration and hydration. The three option factories (queryOptions,infiniteQueryOptions, andmutationOptions) specialize their TypeScript signatures and share one JavaScript identity function.What reaches the browser?
Gzipped Query runtime
For the read-only app, whole-app gzip goes from 76,925 B to 75,107 B (−2.36%). The query-only build excludes MutationCache, the infinite observer, Suspense and unreferenced imperative operations. The bookmark apps include the mutation implementation.
Each push builds four production apps against both packages. The primary percentage uses the compressed Query runtime for that workload, including all retained
query-coremodules. The same comment also measures the whole app with React and React DOM. The build checks the isolated chunk against the module and export graph of the deployable app. Chromium exercises all eight apps, including real Suspense fallback, pagination, polling and mutation flows. Bundle comparison and interactive treemapsThe stock React package’s separate Brotli size-limit measurement is 12,703 → 12,714 B for the full entry (+11 B, +0.09%) and 8,391 → 8,396 B for the minimal entry (+5 B, +0.06%). Preview size-limit report
✅ Checklist
pnpm testandpnpm run test:pron this revision. Ten Next.js example builds stopped on their first run for an upgrade notice and passed on retry. Nx reported 656 successful tasks in both final commands. The GitHub Test job passed.🚀 Release Impact