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] Ensure closures are resolved via App in resolveArrayableProperties #678

Open
wants to merge 4 commits into
base: 2.x
Choose a base branch
from

Conversation

JasperTey
Copy link

This PR resolves a regression in 2.x where shared data closures with arguments could not be resolved. This patch ensures that the closures are resolved using App::call().

e.g.,

Inertia::share('query', fn (Request $request) => $request->query());

I encountered this while trying to upgrade a project to Inertia 2.x. A supporting test has been created to demonstrate further.

@gainlinejono
Copy link

This resolves an issue with the gretel breadcrumbs package, could this be merged? @reinink

@JasperTey
Copy link
Author

This resolves an issue with the gretel breadcrumbs package, could this be merged? @reinink

This was my exact use case as well, good to know I wasn't the only one.

onlime added a commit to onlime/gretel that referenced this pull request Nov 8, 2024
@wizzymore
Copy link

The problem is that - that closure call should not happen here as it is already happenning in the "resolvePropertyInstances" method, and there it works properly. This bug was added in the following commit: 141256b and the change for the Response.php file should be reverted I think it was a left-over from some tests

wizzymore added a commit to wizzymore/inertia-laravel that referenced this pull request Nov 12, 2024
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

Successfully merging this pull request may close these issues.

3 participants