OpenCut icon indicating copy to clipboard operation
OpenCut copied to clipboard

bug(web): TanStack DevTools rendered unconditionally in RootDocument and unpinned dependencies

Open iamameerhamza opened this issue 3 months ago • 3 comments

Platform

All / Linux / macOS / Windows

Browser

All browsers (Chrome / Firefox / Safari)

Current Behavior

  1. <TanStackDevtools /> and <TanStackRouterDevtoolsPanel /> in apps/web/src/routes/__root.tsx are rendered unconditionally inside RootDocument, leaking internal devtools into production bundles.
  2. TanStack dependencies in apps/web/package.json use unpinned "latest" versions, causing non-deterministic builds across environments.

Expected Behavior

  1. Devtools should only render in local development mode when import.meta.env.DEV is true.
  2. TanStack dependencies should be pinned with consistent semver ranges.

Proposed Fix

A verified patch is available in this fork branch: https://github.com/iamameerhamza/OpenCut/tree/fix/web-devtools-and-deps (Commit d11c4c8)

Recurrence Probability

Always

Steps To Reproduce

  1. Inspect apps/web/src/routes/__root.tsx (lines 60–70) and note that <TanStackDevtools /> and <TanStackRouterDevtoolsPanel /> are included directly in RootDocument without an environment guard.
  2. Run a production build (vite build / pnpm build).
  3. Notice internal TanStack devtools components are bundled into the production output.
  4. Inspect apps/web/package.json and notice @tanstack/* dependencies use unpinned "latest".

Anything else?

Patch branch: https://github.com/iamameerhamza/OpenCut/tree/fix/web-devtools-and-deps (Commit d11c4c8)

iamameerhamza avatar Aug 17 '26 02:08 iamameerhamza

Hi, I can work on this if no PR has been opened yet. The fix seems to be guarding the TanStack devtools behind import.meta.env.DEV and pinning the @tanstack/* dependencies in apps/web/package.json.

Please let me know if you’d like me to submit a PR.

rutuja2005byte avatar Aug 17 '26 07:08 rutuja2005byte

/claim

Munishwar001 avatar Aug 19 '26 11:08 Munishwar001

Hi, I've already implemented a fix for this on my fork: https://github.com/seuthootDev/OpenCut/tree/fix/web-devtools-and-deps

Changes:

  • Guarded <TanStackDevtools /> in apps/web/src/routes/__root.tsx behind import.meta.env.DEV
  • Pinned the unpinned @tanstack/* deps in apps/web/package.json (previously "latest") to their current released versions

Verified with a production build (vite build) that no devtools code ends up in dist/client or dist/server output.

Let me know if this is good to go and I'll open a PR.

seuthootDev avatar Aug 22 '26 10:08 seuthootDev