Skip to content

[2.x] Restore router.resolveComponent() method #2039

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

Merged
merged 2 commits into from
Jun 17, 2025

Conversation

pascalbaljet
Copy link
Member

First of all, thanks for all the great work on v2! ❤️

In v1, the resolveComponent method was available on the router instance. This PR restores that for v2.

I am using this in my modal package to resolve the modal component, similarly to resolving a page. Without having this method publicly available, I must duplicate/reference the resolveComponent method in the main app.js file. That would be a shame, as it's so clean and nice in v1 :)

@crankeye
Copy link

Hopefully this PR gets merged because it's much more clean to do it this way.

For anyone else who's upgrading from Inertia 1.x to 2.x you can move the resolve function from createInertiaApp() in your app.js to it's own file. Then you can import the function in both the app.js and wherever you need to call router.resolveComponent.

@pascalbaljet pascalbaljet merged commit 8cc2441 into inertiajs:master Jun 17, 2025
6 checks passed
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.

2 participants