-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Multiple versions of livewire/livewire.js #71
Comments
There was a bugfix a few hours ago in Statamic core (statamic/cms#10306). Can you upgrade and see if it's already fixed? |
Thanks for reporting. Please reply here if the issue still exists, so we can reopen if it does. |
Sorry for the delay in reporting back. All updated to latest and for me at least, the issue remains. I can see the replacers in the head now but still getting duplicate livewire assets. Livewire Statamic Statamic Addons |
Are you using a {{ nocache }} tag? |
No, I'm not using the nocache tag |
Hello |
@mojosef @HannesEURESA do you have a simple repo for sharing that lets me reproduce the issue? |
I can´t share a repo, unfortunately, We got activated static half caching, since then all Pages where we include Livewirecomponents inside Antlers are throwing the error in the console. So this brings problems to all Alpine and Livewire instances on all compoennts which are reachable from this current URL. Example: The Main Navigation is used with Alpine, so now the Menu isn´t working anymore and notDropdown is available. I tried with {{nocache}} to wrap the whole Livewirecomponent, but it´s not working, and if I am wrapping not only the component, but also Inside the component the Elements, it shows me on the frontend that No Cache Placeholder is set. We can´t take the whole Page to exclude from Stataic Caching, because it´s mainly crashing on our main Sites, where the Static caching need to be set of half. I hope I could help |
@marcorieser I have a private repo I'm happy to add you to if it helps. |
Can someone try the following: Publish the Livewire config:
In the config disable assets injection:
and then manually add the tags in your layout file by using If your component passes parameters using the tag, for example |
Yes, that would be a huge help. |
@afonic Is that different from doing it like in the docs? |
@marcorieser No, the key is disabling auto injection in Livewire's config. That how I solved this issue when using half measure caching and Livewire Filters: https://livewirefilters.com/docs/v1/common-issues#content-the-add-on-doesnt-work-correctly-when-using-static-caching My guess is that the cached version of the page contains the assets but the component loads and tries to inject them again. If you have parameters in the component itself, they get saved in the cache because of Livewire's snapshot and then it ignores changing set parameters on boot. I'd be happy to help debug this, but I hit a dead end last time I tried. |
I always include the styles and scripts on every page with the link above or bundle it myself and disable it via |
Thanks @afonic that did the trick, I was about to share the repo, but after trying this, and deploying to the production, everything is working again. |
I've got a strange issue when using full cacheing strategy in production.
If I clear the static cache, the page loads fine ( as there is not cached file to load yet ). However the generated html has 2 instances of livewire.js inserted. This causes issues with livewire and alpine, and gives me the following errors:
index.js:26 Detected multiple instances of Livewire running
ni @ index.js:26
(anonymous) @ index.js:28
(anonymous) @ index.js:53
index.js:26 Detected multiple instances of Alpine running
ni @ index.js:26
(anonymous) @ index.js:29
(anonymous) @ index.js:53
component.js:8 Uncaught Component already initialized
Here is the code generated at the bottom of the static html files
My current config:
Environment
Application Name: **
Laravel Version: 10.48.22
PHP Version: 8.2.5
Composer Version: 2.7.9
Environment: production
Debug Mode: OFF
URL: **
Maintenance Mode: OFF
Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: mailgun
Queue: sync
Session: file
Livewire
Livewire: v3.5.8
Statamic
Addons: 3
Sites: 1
Stache Watcher: Disabled
Static Caching: full
Version: 5.26.0 PRO
Statamic Addons
jonassiewertsen/statamic-livewire: 3.8.0
spatie/statamic-responsive-images: 5.0.1
withcandour/aardvark-seo: 5.0.0
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: