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

Action returning 4XX status code called using fetcher does unnecessary revalidation #13062

Open
lukejagodzinski opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels

Comments

@lukejagodzinski
Copy link

I'm using React Router as a...

framework

Reproduction

https://github.com/lukejagodzinski/rr-should-revalidate-repro

  1. Run npm run dev
  2. Open app in the browser
  3. Open "Network" tab in the browser dev tools
  4. Click the "Use fetcher" button to call action using fetcher
  5. Observe that the request is made and 422 response is returned and the unnecessary revalidation is triggered. This should not happen according to docs.
  6. Click the "Use form submit" button to call the same action but using regular form submission
  7. Observe that the request is made and 422 response is returned but the revalidation is not triggered. This is the expected behavior.

You can also fix the issue by uncommenting the shouldRevalidate function in app/routes/home.tsx:14. However, that should not be necessary.

System Info

System:
    OS: macOS 15.1.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 9.68 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.nvm/versions/node/v20.14.0/bin/node
    npm: 10.7.0 - ~/.nvm/versions/node/v20.14.0/bin/npm
    bun: 1.0.28 - ~/.bun/bin/bun
  Browsers:
    Chrome: 133.0.6943.99
    Safari: 18.1.1
  npmPackages:
    @react-router/dev: ^7.2.0 => 7.2.0 
    @react-router/node: ^7.2.0 => 7.2.0 
    @react-router/serve: ^7.2.0 => 7.2.0 
    react-router: ^7.2.0 => 7.2.0 
    vite: ^5.4.11 => 5.4.14

Used Package Manager

npm

Expected Behavior

RR shouldn't revalidate loaders when action returning error is being called using fetcher

Actual Behavior

RR revalidates loaders after action returning error is being called using fetcher

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

No branches or pull requests

2 participants