-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove incomplete Alpine integration example
- Loading branch information
Showing
1 changed file
with
11 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josevalim Is there a complete one?
f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are blog posts that go step by step, but I can’t say which is up to date. You probably know better.
f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I don't. I saw some posts trying to solve problems with the Alpine/LiveView integration I myself don't have. TBH, other than this
:at
option issue I have with the 0.19.5+ integration I don't have other complaints.f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do the job for Alpine, in fact
clone
function from alpine is deprecated, you should usecloneNode
(https://github.com/alpinejs/alpine/blob/main/packages/alpinejs/src/clone.js#L21)f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Matsa59 The upgrade does not solve the issue with the inserted elements no longer getting initialized.
One still needs to use a hook to initialize Alpine for the inserted element manually, as I described it here:
https://github.com/liveview-alpine/integration?tab=readme-ov-file#alpine-related-hooks-optional
and here:
https://github.com/liveview-alpine/integration?tab=readme-ov-file#prepending-items-to-a-stream-in-lv-v019x
and you must keep the
if
clause you deleted above, otherwise you get this:f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE: Actually, the new
cloneNode
function seems to mess up everything everywhere. It simply does not work the same as the oldclone
function.FYI, the app I am working on is full of Alpine code and it all works with the
clone
function or at least it used to as of LV 0.20.1.Now I can see the latest LV is forcing me to initialize Alpine manually on many more elements than I used to in LV 0.20.1.
@josevalim I'm still in the process of upgrading from 0.20.1 to 0.20.3+ and it's not without new issues (some having nothing to do with Alpine as reported in an issue today).
f7a6ede
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DaTrader maybe you'll be interested by alpinejs/alpine#4000
Alpine badly handle dom changes and for phx-stream phoenix liveview could
append
/delete
/append
for new inserted elementSo I just update the lifecycle system of Alpine and it works great for us