Problem with x-for and HTMX #4476
-
I have a serious problem when using x-for together with htmx. Here is my code. For simplicity I'm using a list (x-data) with one element
The rendered page is this (only the body content):
After clicking login link and then the back button, the rendered page is this:
As you can see, a new div was added. Every time the back button is clicked, a new div appear. Browser is Edge.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
does it work if you use https://v1.htmx.org/extensions/alpine-morph/? |
Beta Was this translation helpful? Give feedback.
-
Not sure how this helps. Does the alpine morph replace htmx swapping mechanism so I don't need to use boost anymore? |
Beta Was this translation helpful? Give feedback.
-
Thanks, I tried but no luck. |
Beta Was this translation helpful? Give feedback.
This is a simple snippet of code to fix x-for and x-if when used with the HTMX history