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

Future flag v3_singleFetch makes clientLoader revalidate even though shouldRevalidate returns false #10234

Open
prxg22 opened this issue Nov 16, 2024 · 0 comments

Comments

@prxg22
Copy link

prxg22 commented Nov 16, 2024

Reproduction

I have an app using the ssr: false option and with the following future flags:

{
  v3_fetcherPersist: true,
  v3_relativeSplatPath: true,
  v3_throwAbortReason: true,
  v3_lazyRouteDiscovery: true,
  v3_singleFetch: true,
}

The app has the nested routes a/b/c.
All of them have clientLoaders and the route a contains a fetcher's Form which will submit to a's clientAction.
Both routes b and c export a shouldRevalidate function returning false to any action submitted to route other than themselves:

// route b:
export const shouldRevalidate = ({
  formAction,
  json,
}: ShouldRevalidateFunctionArgs) => {
  return !formAction || formAction === '/b'
}

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1
    Memory: 125.06 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.3 - /usr/local/bin/npm
    pnpm: 8.15.7 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 130.0.6723.119
    Safari: 17.6
  npmPackages:
    @remix-run/dev: ^2.14.0 => 2.14.0 
    @remix-run/react: ^2.14.0 => 2.14.0 
    @remix-run/serve: ^2.14.0 => 2.14.0 
    @remix-run/server-runtime: ^2.14.0 => 2.14.0 
    vite: ^5.4.11 => 5.4.11

Used Package Manager

npm

Expected Behavior

If the v3_singleFetch flag is false, the app does not execute the b and c clientLoaders when I submit the a's Form and this is what I was expecting when the flag was true

Actual Behavior

If the v3_singleFetch flag is true, the clientLoaders of b and c routes are executed, independently of the shouldRevalidate's return.

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

No branches or pull requests

1 participant