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

Add dinamic parameters to Inertia::lazyLoad props #570

Closed
sot1986 opened this issue Dec 8, 2023 · 1 comment
Closed

Add dinamic parameters to Inertia::lazyLoad props #570

sot1986 opened this issue Dec 8, 2023 · 1 comment

Comments

@sot1986
Copy link

sot1986 commented Dec 8, 2023

Most of the times that I am reaching for lazyLoading props, I would really appreciate to have the possibility to pass some parameters to the callback. I would propose something like:

router.visit(url, { only: ['user:10'] })

On the backed I would handle like

public function __invoke(Request $request)
{  
  return Inertia::render('Users/Page', [  
  'users' => fn () => Users::query()->cursorPaginate(),  
  'user' => Inertia::lazy(fn (User $user) => $user  
  ];  
}

Make sense?

@driesvints
Copy link
Collaborator

Heya, thanks for your proposal. Feel free to attempt a PR so the maintainers can look at actual code that's involved. Thanks

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

No branches or pull requests

2 participants