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

Link prefetch calls loader despite the presence of clientLoader #9575

Closed
nramovs-sr opened this issue Jun 6, 2024 · 2 comments · Fixed by #9580
Closed

Link prefetch calls loader despite the presence of clientLoader #9575

nramovs-sr opened this issue Jun 6, 2024 · 2 comments · Fixed by #9580

Comments

@nramovs-sr
Copy link

Reproduction

https://stackblitz.com/edit/remix-run-remix-s2qdww

Hover on link to 'Other', in network devtools you can see a request for loader, and server log shows that loader was called.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @remix-run/dev: * => 2.9.2 
    @remix-run/node: * => 2.9.2 
    @remix-run/react: * => 2.9.2 
    @remix-run/serve: * => 2.9.2 
    vite: ^5.1.0 => 5.2.12

Used Package Manager

npm

Expected Behavior

When using <Link to="" prefetch="intent">, prefetch will fetch the loader from network, while navigating to that page will correctly only call clientLoader.

In case of using clientLoader as https://remix.run/docs/en/main/guides/client-data#skip-the-hop, that caused double network requests and result from loader is discarded.

Actual Behavior

Either call clientLoader, or no loader at all.

When adding a clientLoader to existing route I would expect that loader _data request will never trigger again unless I explicitly call serverLoader, even if I forget to remove prefetch from Link elements

Copy link
Contributor

🤖 Hello there,

We just published version 2.10.0-pre.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 2.10.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@brophdawg11 brophdawg11 removed the awaiting release This issue has been fixed and will be released soon label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants