Skip to content

Conversation

@crnkovic
Copy link
Contributor

@crnkovic crnkovic commented Oct 7, 2021

Summary

If you manually register a component with Livewire\Livewire::component('name', MyComponent::class), Livewire will not recognize that the component has been registered if you check with app(LivewireManager::class)->getClass('name'). However, if checking using the facade Livewire\Livewire::getClass('name') it will successfully find that component. Keep in mind that Livewire\Livewire::class is just a facade for Livewire\LivewireManager::class.

This has produced a bug where middleware to drop requests would fail even if the component is valid, only if the component has been manually registered (i.e. outside of default namespace).

Updated tests accordingly.

Checklist

  • I checked my UI changes against the design and there are no notable differences
  • I checked my UI changes for any responsiveness issues
  • I checked my (code) changes for obvious issues, debug statements and commented code
  • I provided a screenshot of my changes to the component (if applicable)
  • I regenerated the icons.html file and checked if my newly added icon is shown correctly (if necessary)
  • I added an explanation on how to use the component to the readme (if necessary)
  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

@alexbarnsley alexbarnsley self-assigned this Oct 7, 2021
@faustbrian faustbrian merged commit 88c80b9 into main Oct 8, 2021
@faustbrian faustbrian deleted the fix/unable-to-resolve-livewire-components branch October 8, 2021 00:37
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.

5 participants