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

Issue with Laravel, Jetstream, and Backpack Interaction #1349

Closed
tjarrett opened this issue Jul 29, 2023 · 1 comment · Fixed by #1350
Closed

Issue with Laravel, Jetstream, and Backpack Interaction #1349

tjarrett opened this issue Jul 29, 2023 · 1 comment · Fixed by #1350
Labels

Comments

@tjarrett
Copy link

Description:

I encountered an issue during a fresh install of Laravel 10 with Jetstream 2.x and Backpack 6.0. It seems that Backpack's service provider fires before Jetstream's service provider, leading to a problem with the resolution of BladeCompiler::class.

Consequently, the Jetstream Livewire components are not properly configured, as they rely on a callback that occurs after BladeCompiler::class is resolved.

Steps to Reproduce:

Perform a fresh install of Laravel 10.
Install Jetstream 2.x and Backpack 6.0 using auto-discovery.

Expected Results:

The order of service provider firing should not affect the configuration of Livewire components. Jetstream should handle the situation gracefully, ensuring proper setup regardless of the order of service providers.

Actual Results:

Backpack's service provider fires before Jetstream's, causing BladeCompiler::class to be resolved before Jetstream's service provider has a chance to run. As a result, Jetstream registers a callback for after BladeCompiler::class is resolved and since it is already resolved the callback never fires and Jetstream's Livewire components are never registered.

Workaround:

To mitigate the issue, I disabled auto-discovery and arranged for Backpack to execute after Jetstream, which seemed to resolve the problem.

Potential Solution:

I have reported this issue to Backpack, they might fix it on their end.

Nevertheless, it might be worth considering a potential solution within Jetstream as well. One possible approach is to have Jetstream check if BladeCompiler::class is already resolved during its setup process. If it is resolved, Jetstream could immediately proceed with setting up the Livewire components appropriately.

Additional Notes:

I must admit that I'm not entirely certain about the implications of implementing the suggested solution. Therefore, I'm willing to collaborate and submit a pull request to Jetstream if this approach seems beneficial and is deemed a potential fix.

I appreciate your attention to this matter and look forward to a resolution, whether through Backpack's or Jetstream's updates.

Thank you!

@crynobone
Copy link
Member

register() method should only be used to define services and Backpack shouldn't resolved Blade there and instead use boot(). Alternatively, Backpack should follow Jetstream style to only interacts with Blade when it being resolve.

@crynobone crynobone added the bug label Jul 29, 2023
taylorotwell pushed a commit that referenced this issue Jul 30, 2023
* [3.x] Use available `ServiceProvider::afterResolving()` 

fixes #1349

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

Successfully merging a pull request may close this issue.

2 participants