Skip to content

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

Closed

Description

@edcaron

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

Kazam_screencast_00005.mp4

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 up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions