Skip to content
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

Unlock Livewire version #15559

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Unlock Livewire version #15559

merged 1 commit into from
Feb 10, 2025

Conversation

danharrin
Copy link
Member

From #15062:

The Async Alpine (v1) version was locked a while ago due to issues released in a minor version. We cannot receive updates to this package.

2 weeks ago we locked Livewire in v3.2.125 as it caused issues when using tables.

A discussion revealed the reason the tables broke was because Alpine.js started not initialising components within x-ignored elements.

The x-ignore needs to be present when using Async Alpine v1, and our tables use Async Alpine and contain nested Alpine.js components.

Since it does not look like this change is going to be reverted in Alpine.js, and it is not great having the Livewire version locked in Filament as it prevents users from being able to use new Livewire features elsewhere in their apps, I am removing Async Alpine from the tables so I can remove the x-ignore and unlock Livewire.

Simply removing Async Alpine from tables did not fix the problem, and using Async Alpine v1 seems completely incompatible with Livewire > v3.5.12. We had to revert #15062. Livewire has remained locked to this version since then.

While locking Livewire hasn't caused too many complaints for us to far, there have been several comments and issues about it. I imagine this problem will get worse over time as more dependencies bump their minimum Livewire version. It looks like Flux has already done this, and Flux is due to be included in the new Laravel starter kit. When the new starter kits are released, people using them and installing Filament at the same time will probably end up with a broken version of Filament before Livewire was locked. The same issue may be encountered by people using Flux without the starter kit. I would like it if Flux and Filament can both be installed in the same Laravel project and still work.

We need to take other action to unlock the Livewire version. This is the first attempt at doing so. This PR upgrades Async Alpine to v2. We were not planning to do this before Filament v4 as there are breaking changes in the package, so Filament plugins would break if they are not using the new Async Alpine syntax:

  • ax-load attributes need renaming to x-load
  • ax-load-src attributes need renaming to x-load-src
  • x-ignore attributes need removing from Async Alpine component root elements

One method of action that we could take is using the Blade compiler to perform these replacements at render time. A regex would be required to identify this attributes, which could be inaccurate depending on the content of the view - Alpine.js attribute values could contain many unpredictable characters and mess with identification.

This PR introduces JavaScript to identify attributes that need to be upgraded, and do so on page render and when the mutation observer detects changes to the DOM. I hope that this allows plugins to continue to use the Async Alpine v1 syntax while fixing its incompatibility with Livewire.

@danharrin danharrin added the bug Something isn't working label Feb 9, 2025
@danharrin danharrin added this to the v3 milestone Feb 9, 2025
@danharrin danharrin merged commit fe8e16c into 3.x Feb 10, 2025
21 checks passed
@danharrin danharrin deleted the attempt-to-unlock-livewire-again branch February 10, 2025 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant