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

[4.x] Prevent calling Inertia before it's installed #1376

Merged
merged 1 commit into from Sep 18, 2023
Merged

[4.x] Prevent calling Inertia before it's installed #1376

merged 1 commit into from Sep 18, 2023

Conversation

jrd-lewis
Copy link
Contributor

When you pull in Jetstream into a fresh Laravel project manually and try accessing it in a browser before running the php artisan jetstream:install command, it will have the error that "Class 'Inertia\Inertia' not found" from the ShareInertiaData middleware. To prevent that, I added a check to ensure the class is present before calling the bootInertia method in the ServiceProvider.

image

@jrd-lewis jrd-lewis changed the title Prevent calling Inertia before it's installed [4.x] Prevent calling Inertia before it's installed Sep 16, 2023
@driesvints
Copy link
Member

I don't think this is necessary? Why would you try to run the app before running the install command?

@jrd-lewis
Copy link
Contributor Author

jrd-lewis commented Sep 17, 2023

It would bring consistency with line 40 of this service provider where it ensures Livewire is installed before registering the Livewire components.

One use case is someone is doing TDD for their project and pulls in Jetstream to handle authentication redirections for guest users but doesn't run the install command immediately. In that case, it would bring up the error about the Inertia class not being found as it does in the browser.

@taylorotwell taylorotwell merged commit 83056da into laravel:4.x Sep 18, 2023
7 checks passed
@jrd-lewis jrd-lewis deleted the inertia-bug-fix branch September 18, 2023 15:00
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.

None yet

3 participants