Skip to content
New issue

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

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

Already on GitHub? # to your account

Start - setting validateClient to true on a middleware doesn't prevent hitting server in case of having validation errors. #3646

Open
ostadomid opened this issue Mar 3, 2025 · 0 comments

Comments

@ostadomid
Copy link

Which project does this relate to?

Start

Describe the bug

As mentioned here when we set validateClient to true on a middleware,
it can save us a round trip to the server by first validating on client side.

In the example I've provided the client side validation never happens and server function is called and validation occurs on the sever.

Image

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-d9oky75u?file=app%2Froutes%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Open the example
  2. On the home page (route="/") click the Create New Post button.
  3. Check the Terminal output, it shows the serverfn has been called and error 500 occured!

Image

Expected behavior

Based on documentation, I expected validation check happens first on the client and server function not being called.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Edge
  • Version:
    react-router: 1.112.0
    react-start: 1.112.3

Additional context

No response

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant