Skip to content

feat(perf): swap React for @tanstack/dom-vite shim#836

Open
tannerlinsley wants to merge 2 commits intomainfrom
shim-migration
Open

feat(perf): swap React for @tanstack/dom-vite shim#836
tannerlinsley wants to merge 2 commits intomainfrom
shim-migration

Conversation

@tannerlinsley
Copy link
Copy Markdown
Member

@tannerlinsley tannerlinsley commented Apr 19, 2026

Summary

  • Installs @tanstack/dom-vite@0.1.0-alpha.2 and enables the tanstackDom() Vite plugin, which aliases react / react-dom / react-dom/server / scheduler to a drop-in React-compatible shim (~9-10KB gzipped, single dep pulls the full set).
  • Excludes lucide-react from optimizeDeps to avoid the RSC client/ssr/rsc pre-bundle hash divergence the shim exposes.
  • Bundle: app-shell + react gzip 160KB → 116KB (-44KB). Desktop Lighthouse ≈ parity; mobile Lighthouse slightly better (-128ms FCP, -27ms TBT).

Also piggybacks an oxlint cleanup: ignore .claude/ and disable nested-config discovery so stale agent worktrees inside the repo don't cause pnpm lint / pre-commit to fail on their nested .oxlintrc.json copies.

Test plan

  • pnpm dev — homepage renders, no console errors
  • pnpm build — completes, inspect dist/ bundle sizes
  • pnpm start:prod — production server renders homepage
  • pnpm test:smoke — all 4 routes green (already verified in pre-commit)
  • Visual smoke-check: navbar, docs pages, npm-stats chart, RSC islands
  • Netlify preview deploy: verify SSR + hydration + streaming Suspense

Summary by CodeRabbit

  • Chores
    • Added a development plugin to the build pipeline for improved dev tooling.
    • Adjusted dependency pre-bundling to prevent inconsistent optimization warnings.
    • Updated linting behavior to disable nested config resolution and expanded lint ignore patterns to exclude additional temp/metadata directories.
    • Added a new dev dependency to support the updated tooling.

Drop-in React-compatible shim (~9-10KB gzipped) replacing react / react-dom /
react-dom/server via the @tanstack/dom-vite Vite plugin. Installing just
@tanstack/dom-vite pulls the full set (dom-core, scheduler, react, react-dom,
react-dom-server) transitively.

Build-size win: app-shell + react gzip 160KB → 116KB (-44KB).
Mobile Lighthouse: slight improvement (-128ms FCP, -27ms TBT).
Desktop Lighthouse: parity with baseline.

Also:
- oxlint: ignore .claude/, disable nested config discovery so stale agent
  worktrees with their own oxlintrc copies don't break lint.
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 19, 2026

Deploy Preview for tanstack ready!

Name Link
🔨 Latest commit 8a00018
🔍 Latest deploy log https://app.netlify.com/projects/tanstack/deploys/69e48c1a2f645900088d059e
😎 Deploy Preview https://deploy-preview-836--tanstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 35 (🔴 down 17 from production)
Accessibility: 90 (no change from production)
Best Practices: 83 (🔴 down 9 from production)
SEO: 97 (no change from production)
PWA: 70 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 19, 2026

📝 Walkthrough

Walkthrough

Added TanStack DOM plugin to Vite, updated lint script to disable nested oxlint configs, extended oxlint ignore patterns to include .claude, and excluded lucide-react from Vite dependency pre-bundling. No runtime code or public API changes.

Changes

Cohort / File(s) Summary
Linting config
\.oxlintrc.json, package.json
Added .claude to oxlint ignorePatterns; updated lint script to run oxlint --type-aware --disable-nested-config.
Vite / deps config
vite.config.ts, package.json
Added tanstackDom() to Vite plugins; added lucide-react to optimizeDeps.exclude; introduced @tanstack/dom-vite@0.1.0-alpha.3 as a devDependency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nibble lines of code with cheer,
TanStack DOM hops quietly near,
.claude hides from oxlint's view,
lucide rests — prebundle too,
A tiny patch, a tidy cheer! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and concisely describes the main change: replacing React with a @tanstack/dom-vite shim to improve performance, which is the core objective of this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch shim-migration

Comment @coderabbitai help to get the list of available commands and usage tips.

Brings in raw REACT_LAZY_TYPE child handling in both SSR (walkNode) and
client (pushChildren). RSC Flight serializes 'use client' components —
CodeBlock, CodeBlockView, CodeExplorer, etc. — as bare lazy objects
directly in the tree (not wrapped in REACT_ELEMENT_TYPE). The previous
shim dropped those silently, so code snippets disappeared on docs pages
(e.g. /virtual/latest/docs/introduction).
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 125: The dependency entry "@tanstack/dom-vite": "0.1.0-alpha.3" is
invalid (package/version not published) and will break installs; remove or
replace it in package.json and update any imports accordingly — either change
the dependency to a published package/version or delete the entry and then
remove or adjust the import of tanstackDom in vite.config.ts (the import
statement referencing `@tanstack/dom-vite`) so the build uses a correct package
name or no import at all.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: afede75b-8f27-455a-8631-d01234c36ab4

📥 Commits

Reviewing files that changed from the base of the PR and between 3e36a90 and 8a00018.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • package.json

Comment thread package.json
"@playwright/test": "^1.59.0",
"@shikijs/transformers": "^4.0.2",
"@tanstack/devtools-vite": "^0.6.0",
"@tanstack/dom-vite": "0.1.0-alpha.3",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Is @tanstack/dom-vite@0.1.0-alpha.3 published on npm, and what changed from 0.1.0-alpha.2 (especially SSR/client handling of raw REACT_LAZY_TYPE children)?

💡 Result:

No, @tanstack/dom-vite@0.1.0-alpha.3 is not published on npm. Extensive searches across npm registry, TanStack repositories, GitHub, and related TanStack Vite plugins (like @tanstack/devtools-vite, @tanstack/vite-config, @tanstack/start-vite-plugin) returned no evidence of this package or version existing. No changelog or mentions of changes from alpha.2 to alpha.3, including SSR/client handling of REACT_LAZY_TYPE children, were found. The package name may be a misremembered or unpublished/internal TanStack project.

Citations:


🏁 Script executed:

# Find vite.config file and check its imports
fd -e ts -e js -e mts -e mjs "vite.config" | head -5

Repository: TanStack/tanstack.com

Length of output: 79


🏁 Script executed:

# Also search for any references to `@tanstack/dom-vite` in the codebase
rg "@tanstack/dom-vite" --type ts --type js

Repository: TanStack/tanstack.com

Length of output: 128


🏁 Script executed:

cat -n vite.config.ts | head -30

Repository: TanStack/tanstack.com

Length of output: 1513


Remove non-existent package dependency

Line 125 adds @tanstack/dom-vite@0.1.0-alpha.3, but this package and version do not exist on npm. While vite.config.ts imports tanstackDom from @tanstack/dom-vite (line 3), the specified version is not published. Adding this to package.json will cause npm install to fail. Either use a published version of this package, find the correct package name, or remove the dependency if it's not needed for this build.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 125, The dependency entry "@tanstack/dom-vite":
"0.1.0-alpha.3" is invalid (package/version not published) and will break
installs; remove or replace it in package.json and update any imports
accordingly — either change the dependency to a published package/version or
delete the entry and then remove or adjust the import of tanstackDom in
vite.config.ts (the import statement referencing `@tanstack/dom-vite`) so the
build uses a correct package name or no import at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant