router icon indicating copy to clipboard operation
router copied to clipboard

fix: optimizeDeps for react-form-start

Open eve0415 opened this issue 1 month ago β€’ 2 comments

Tanstack Form has silently created a new package named @tanstack/react-form-start recently. Branch

The usage example is in this docs.

This PR, also optimize deps for @tanstack/react-form-start to fix vite not resolving the use-sync-external-store package.

Summary by CodeRabbit

  • Chores
    • Updated Vite plugin to improve dependency optimization handling for TanStack React Start packages, adding a conditional inclusion for the "start" form package.
    • Adjusted Cloudflare environment typings to preserve literal value types and improve formatting of the declared environment mapping.

✏️ Tip: You can customize this high-level summary in your review settings.

eve0415 avatar Nov 20 '25 23:11 eve0415

Walkthrough

Adds a conditional transitive include to the Vite optimizeDeps list for the react-start plugin and adjusts Cloudflare Env typing in an e2e declaration, preserving literal types and formatting.

Changes

Cohort / File(s) Summary
Vite plugin optimizeDeps configuration
packages/react-start/src/plugin/vite.ts
Add conditional spread that includes '@tanstack/react-form-start > @tanstack/react-store' in optimizeDeps.include when '@tanstack/react-form-start' appears in optimizeDeps.exclude, mirroring the existing pattern for '@tanstack/react-form'.
Cloudflare Env typings (e2e)
e2e/solid-start/basic-cloudflare/worker-configuration.d.ts
Adjust formatting and literal typing: change MY_VAR string literal quoting/formatting; update StringifyValues<M> to preserve EnvType[Binding] when a bound is a string (instead of forcing string); update NodeJS.ProcessEnv pick to reflect the preserved literal type.

Sequence Diagram(s)

N/A β€” changes are configuration and type adjustments that don't modify runtime control flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review Vite plugin conditional logic to ensure pattern matches existing implementation.
  • Verify the d.ts typing changes preserve intended literal types and don't widen types unexpectedly.
  • Check e2e typing formatting for consistency with surrounding declarations.

Possibly related PRs

  • TanStack/router#5726 β€” Adds the same conditional transitive include pattern for @tanstack/react-form in the Vite plugin, which this PR mirrors for the "start" variant.
  • TanStack/router#5223 β€” Related modifications to optimizeDeps configuration in the same Vite plugin file.

Poem

🐰 I hopped through configs, tidy and smart,
Mirrored a rule for the form-start part.
Typings trimmed neat, includes set just right,
Bundles hum softly into the night. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
βœ… Passed checks (2 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title 'fix: optimizeDeps for react-form-start' directly and clearly describes the main change: adding optimizeDeps configuration for the react-form-start package to resolve Vite dependency issues.
✨ Finishing touches
  • [ ] πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

πŸ“œ Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 61db78a0202bcefb816e2bb2512949371de0b66a and a27bfbfbf651cdfcb3fb71390d8ad30c6323ba46.

πŸ“’ Files selected for processing (1)
  • e2e/solid-start/basic-cloudflare/worker-configuration.d.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
πŸ““ Common learnings
Learnt from: nlynzaad
Repo: TanStack/router PR: 5732
File: packages/start-client-core/src/client/hydrateStart.ts:6-9
Timestamp: 2025-11-02T16:16:24.898Z
Learning: In packages/start-client-core/src/client/hydrateStart.ts, the `import/no-duplicates` ESLint disable is necessary for imports from `#tanstack-router-entry` and `#tanstack-start-entry` because both aliases resolve to the same placeholder file (`fake-start-entry.js`) in package.json during static analysis, even though they resolve to different files at runtime.
πŸ”‡ Additional comments (1)
e2e/solid-start/basic-cloudflare/worker-configuration.d.ts (1)

5-7: Env/StringifyValues typing change is sound and improves literal safety

Defining MY_VAR as the literal 'Hello from Cloudflare' and updating StringifyValues to preserve literal string types while collapsing non‑string env bindings to string makes ProcessEnv more precise without breaking the string-only runtime contract. The Pick<Cloudflare.Env, 'MY_VAR'> usage ensures process.env.MY_VAR is correctly typed to that literal in this e2e setup.

Only minor thing to keep in mind: if StringifyValues is reused elsewhere with union types like string | undefined or string | number, those will now fall back to string, which still matches how environment variables behave but slightly changes previous type inferences. If that’s intentional, this looks good to ship.

Also applies to: 11-14, 16-17


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.

❀️ Share

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

coderabbitai[bot] avatar Nov 20 '25 23:11 coderabbitai[bot]

View your CI Pipeline Execution β†— for commit a27bfbfbf651cdfcb3fb71390d8ad30c6323ba46

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... β›” Cancelled 22s View β†—
nx run-many --target=build --exclude=examples/*... βœ… Succeeded 10s View β†—

☁️ Nx Cloud last updated this comment at 2025-11-21 13:55:36 UTC

nx-cloud[bot] avatar Nov 21 '25 13:11 nx-cloud[bot]