Skip to content
Source
Sign inSign up
TanStack/router

React: using validateSearch with zod schema with default values makes the abortController abort the request on the loader: signal is aborted without reason #6371

Closededcaron(GitHub profile, opens in a new tab) opened this issue 0 comments

Which project does this relate to?

Router

Describe the bug

When using validateSearch with zod schema with default values makes the abortController abort the fetch request on the loader with "signal is aborted without reason" when entering the route via typing on the url without the default route parameters on the url. This only happens when directly entering the route via url. Navigating programmatically using Link works normally.

Your Example Website or App

https://codesandbox.io/p/sandbox/tanstack-router-cancelation-issue-forked-fg3s4z

Steps to Reproduce the Bug or Issue

  1. go to the repo: https://codesandbox.io/p/sandbox/tanstack-router-cancelation-issue-forked-fg3s4z
  2. open the preview
  3. open the chrome devtools for the preview
  4. click on the link "about"
  5. edit the preview url and remove everything after /about and hit enter
  6. check the chrome devtools for the preview that will have the error

Expected behavior

The behavior would be that the default route params would be added to the url and the content would be loaded using the fetch on the loader with no error.

Screenshots or Videos

https://github.com/user-attachments/assets/3bf1de2f-778e-4245-8446-82c4f0a35c13

Platform

  • Router / Start Version: 1.147.3
  • OS: linux
  • Browser: Chromium
  • Browser Version: : 143.0.7499.169
  • Bundler: vite
  • Bundler Version: 7.1.7

Additional context

to make it happen:

  • must use zod with default values for props
  • must use validateSearch with the zod schema
  • must use fetch on the loader function and add the abortController.signal to the signal param on the fetch function

Sign in to join this conversation.