[4.x] Prevent calling Inertia before it's installed#1376
Merged
taylorotwell merged 1 commit intolaravel:4.xfrom Sep 18, 2023
jrd-lewis:inertia-bug-fix
Merged
[4.x] Prevent calling Inertia before it's installed#1376taylorotwell merged 1 commit intolaravel:4.xfrom jrd-lewis:inertia-bug-fix
taylorotwell merged 1 commit intolaravel:4.xfrom
jrd-lewis:inertia-bug-fix
Conversation
Member
|
I don't think this is necessary? Why would you try to run the app before running the install command? |
Contributor
Author
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When you pull in Jetstream into a fresh Laravel project manually and try accessing it in a browser before running the
php artisan jetstream:installcommand, 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 thebootInertiamethod in the ServiceProvider.