Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start - route validators (params and validateSearch) not working on page reload #3711

Open
Rothiusx opened this issue Mar 9, 2025 · 0 comments

Comments

@Rothiusx
Copy link

Rothiusx commented Mar 9, 2025

Which project does this relate to?

Start

Describe the bug

I'm having a bit of a trouble with route validators for params and search. When navigating within the app everything works as expected (same as using router on client apps only), but when paired with Start I encountered an issue when entering the page from outside or just reloading the page. Then the validators won't work and page will show as if params or search params passed the route validation.

Minimal example is using create-tsrouter-app with TanStack Start option and has installed Zod, everything else is default with removed example routes.

Your Example Website or App

https://github.com/Rothiusx/tanstack-start-route-validators

Steps to Reproduce the Bug or Issue

  1. Home page should have 3 links - 1 valid and 2 invalid
  2. Try all 3 links within the app (navigation with Link component)
  3. You should see Zod error on 2 of these links as expected
  4. Go to one of the invalid routes (you should see error)
  5. Reload the page (F5) or open the url in new tab
  6. The validation fill flash for a moment and route will be rendered and validation skipped and hydration error shows

Expected behavior

The behavior when reloading the page should be same as navigating within app - validation should NOT be skipped. It is working as expected when using router on client only apps. Issue is most likely somewhere within SSR/hydration. App also throws hydration errors on reload.

Screenshots or Videos

2025-03-09.23-01-28.mp4

Platform

  • OS: Windows 11
  • Browser: Chrome
  • Version: 133.0.6943.142

Additional context

Issue originally created on TanStack discord in router questions section.

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

No branches or pull requests

1 participant