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

[2.x] Prefetch doesn't load deferred props #2108

Open
javieralarcn10 opened this issue Nov 26, 2024 · 2 comments
Open

[2.x] Prefetch doesn't load deferred props #2108

javieralarcn10 opened this issue Nov 26, 2024 · 2 comments
Labels
react Related to the react adapter

Comments

@javieralarcn10
Copy link

javieralarcn10 commented Nov 26, 2024

Version:

  • @inertiajs/react version: 2.0.0-beta.2

Describe the problem:

When I prefetch a <Link prefetch/> it only loads props that don't have the Inertia::defer method.

Steps to reproduce:

Controller:
return inertia('Dashboard/Products/Inventory', [ 'shop' => $shop, 'inventory' => Inertia::defer(fn() => $shop->inventory), ]);

Frontened:
<Link prefetch href={route("inventory")} className="flex gap-2 items-center"> <span className="font-medium text-white">Inventory</span> </Link>

@javieralarcn10 javieralarcn10 added the react Related to the react adapter label Nov 26, 2024
@mreduar
Copy link

mreduar commented Dec 11, 2024

That is not the objective of defer? That they only load when you enter the page?

@RobertBoes
Copy link
Contributor

I agree, it shouldn't prefetch deferred props, as that may take a long time while in the meantime the user could navigate, which would then cause the page to load very slowly

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

No branches or pull requests

3 participants