Regression in x-init behavior since v3.14.4 with Laravel/Livewire integration #4453
Replies: 2 comments 1 reply
-
|
Seems to be caused by #4000 As per #4000 (comment) yes, my Livewire V2 is messed up |
Beta Was this translation helpful? Give feedback.
-
|
In our case, we have a modal with a top-level x-data and an inner autonomous Alpine component (with its own x-data). Everything works fine on Alpine 3.14.3, but starting from 3.14.4 the nested component doesn’t initialize anymore. There are no console errors, it just silently fails to boot. It looks like the regression in how x-init interacts with Livewire re-renders (mentioned above) is exactly what’s breaking our setup. I suppose there is no fix planned ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Since updating Alpine.js to version
3.14.4(released two days ago), I have noticed a breaking change in the behavior of thex-initdirective when used in combination with Laravel and Livewire. This issue was not present in version3.14.3.Steps to reproduce
wire:keyin the markup to trigger re-renders:Expected behavior
In version
3.14.3and earlier, each time the Livewire component re-renders, thewire:keychanges, the<div>is regenerated, andx-initis executed again. This logsHello Worldto the console on every re-render, which is crucial for re-initializing JavaScript-dependent components (charts, viewers, etc.).Observed behavior
Starting with version
3.14.4, thex-initdirective no longer re-executes after a Livewire re-render. This causes major issues in my project because components that depend on JavaScript initialization (like charts or custom viewers) are not being properly re-initialized.Environment details
Additional context
Due to infrastructure constraints, we are currently on an older version of Laravel and PHP. Despite this, the issue seems specific to changes introduced in Alpine.js
3.14.4, as downgrading to3.14.3resolves the problem.This regression significantly impacts our ability to use Alpine.js in conjunction with Livewire for dynamic components. Please investigate and let me know if there are any workarounds or upcoming fixes.
Thank you for your help!
Beta Was this translation helpful? Give feedback.
All reactions