-
-
Notifications
You must be signed in to change notification settings - Fork 106
Description
Version
v5.0.5
What did you expect to happen?
When using Livewire on some pages I created inside of wp-admin, the @livewireScripts command outputs a script URL that references the routes generated by Livewire. The output of @livewireScripts should result in a URL like https://mydomain.com/livewire/livewire.min.js.
What actually happens?
In the new version of Livewire v4, they are now using the Laravel url() helper to generate URLs. In v3, they used a root-relative path. Inside of wp-admin, the Laravel url() function returns https://mydomain.com/wp-admin/admin.php, which is the page URL I'm using, not the root URL. I briefly tested the front end, and url() appears to work correctly there, so likely something related to wp-admin. Here is a link to the discussion on the Livewire repo.
The result is that @livewireScripts renders URLs (and update URLs) that don't match the Livewire routes. Instead of https://mydomain.com/livewire/, we get https://mydomain.com/wp-admin/admin.php/livewire/.
Steps to reproduce
- Install Livewire v4
- Render @livewirescripts inside of wp-admin, either in the footer or in a template.
- Compare the rendered URLs to the Laravel route table and note the mismatch.
System info
No response
Log output
Please confirm this isn't a support request.
Yes