$screen seems to be broken in combination with Livewire
See original GitHub issueI have a fairly complex setup and I first thought that it was the reason that it did not work anymore.
However see the simple code below that currently does not work with $screen('sm')
, and gives this error: Uncaught ReferenceError: $screen is not defined
<script src="https://cdn.jsdelivr.net/gh/alpine-collective/alpine-magic-helpers@1.1.x/dist/index.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js"></script>
<div x-data="">
<div x-show="$screen('sm')">
SHOW ON > SM ONLY (DOES NOT WORK)
</div>
</div>
{{-- remove this line and it works... --}}
@livewireScripts
You can toy around here where I also added my usecase with an x-data
function:
https://laravelplayground.com/#/snippets/81b039fe-6a65-479b-aa40-d17bc37d7b75 (go to livewire.blade.php)
Note:
- I included alpine-magic-helpers first, then AlpineJS
- there is even no Livewire component in the playground active
I think there is something wrong with the registration of the $screen helper
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Troubleshooting | Laravel Livewire
The most common issues encountered by Livewire users has to do with Livewire's DOM diffing/patching system. This is the system that selectively updates ......
Read more >Problem with filter results - Need to refresh · Issue #375 - GitHub
On firebird sorting is broken, showing all previous rows instead actual row count. Combining with user columns breaks it even more as seen...
Read more >Building a realtime dashboard powered by Laravel, Livewire ...
We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that ...
Read more >laravel - livewire and vite not playing together well
However, as soon as livewire tries to send the data back to the form, I get a totally blank screen. In fact, I...
Read more >I Love Writing JavaScript, But Livewire Is A Great Way To ...
AJAX for pagination? That improves UX when searching. A full page refresh between screens that are for totally different data? Chill, it's fine....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, it works okay if you follow the defer rule we discussed above but if you put the library before livewire without defer, livewire will just override the code. 😦
Could PR livewire too I suppose!