1.8.1: detect TanStack Start/Router/Query in production - #5
Conversation
- read the production globals __TSR_ROUTER__ and __TSS_START_OPTIONS__ (1.8.0 looked for dev-only names that production never sets) - bounded React-tree walk (6k fibers / 25 ms) finds provider clients with no global: TanStack Query, TanStack Router, React Router data routers, Redux, Apollo — shape-checked, works when React hydrates document - manual chunk names tanstack-router-*.js / tanstack-query-*.js - foreign webpack globals on Vite-based TanStack Start are low - corpus: + tanstack.com, railway.com, bolt.new; all 49 sites recaptured - 1.8.1
There was a problem hiding this comment.
📋 Review Summary — Not ready to merge
1 medium finding would be worth fixing before merging.
Findings
The nextjs.org corpus update makes npm test fail ▶
Fix with agent prompt
These are the findings from a code review of this pull request.
## 1. The nextjs.org corpus update makes npm test fail
Path: tests/corpus/nextjs.org.json
Line: 18
Issue: This snapshot removes `vercel:high`, but `tests/corpus/sites.json` still lists `vercel` as a required hit for `nextjs.org`; `tests/corpus.test.js` gives `sites.json` precedence over the per-record `expect`, so `npm test` fails with `nextjs.org: expected vercel`.
Suggested fix:
- Update `tests/corpus/sites.json` so the `nextjs.org` expectation matches the new capture, or restore a Vercel signal/snapshot entry if Vercel is still intended to be required.
---
For each finding above, determine whether it is valid and should be fixed. If so, fix it directly. Where a finding offers several remedies, pick one and say why. Leave the pull request's own changed files alone unless a fix requires touching them.Summary
The change adds production TanStack Start/Router globals, React-fiber provider scanning, TanStack chunk-name signatures, and corpus updates for the 1.8.1 release. The detection implementation is mostly coherent, but the committed corpus expectations are internally inconsistent: the Next.js capture no longer reports Vercel while the corpus manifest still requires it, so the offline test suite fails before merge.
Commands
Re-review the latest changes:
@xhawk-ai review again
Resolve all review threads and post a summary:
@xhawk-ai resolve all
| "tailwind:high", | ||
| "turbopack:high", | ||
| "vercel:high" | ||
| "turbopack:high" |
There was a problem hiding this comment.
The nextjs.org corpus update makes npm test fail
This snapshot removes vercel:high, but tests/corpus/sites.json still lists vercel as a required hit for nextjs.org; tests/corpus.test.js gives sites.json precedence over the per-record expect, so npm test fails with nextjs.org: expected vercel.
Suggestions
Update tests/corpus/sites.json so the nextjs.org expectation matches the new capture, or restore a Vercel signal/snapshot entry if Vercel is still intended to be required.
…ge — not a stable expectation
WhatStack 1.8.1 — TanStack in production
1.8.0 only recognised TanStack from package names in asset URLs
(
@tanstack/react-query@…) and from dev-only globals. Production apps shiphashed chunks, so real TanStack Start, Router and Query apps showed nothing:
tanstack.com itself reported only Tailwind, Sentry and Google Analytics.
What changed
window.__TSR_ROUTER__(a router withroutesById+buildLocation) andwindow.__TSS_START_OPTIONS__. 1.8.0 looked for__TANSTACK_ROUTER__/__TANSTACK_START__, which don't exist in production builds.have no global in production, but their clients are passed to a provider
component. The MAIN-world probe walks the React tree from the root fiber
(at most 6,000 fibers or 25 ms) and accepts only objects with the library's
shape: a QueryClient has
getQueryCache+getMutationCache, a TanStackrouter has
routesById+buildLocation, a React Router data router hasroutes,navigate,subscribeandstate, a Redux store hasdispatch/getState/subscribe, an Apollo client haswatchQuery/query/cache. Works when React hydratesdocument(TanStack Start).tanstack-router-B-OQbHRF.js,tanstack-query-….js)count as evidence; image names still never do.
webpackChunk_osano_…on aVite-built TanStack Start site is shown as low, like Parcel on Next.js in 1.8.0.
Measured (real extension, headless Chromium)
@tanstack/react-queryin its package.json)No other result in the 49-site golden corpus changed (nextjs.org's Vercel hint
came from a lazily loaded image and did not load during the second capture).
Not verifiable from here
no TanStack, React Router or Remix markers. The logged-in app may differ.
Both can be checked in a real browser; see the README.