-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Htmx + alpine problems #2910
Comments
Hey, could you provide code examples so we can investigate ? Hard to debug otherwise! Hope this helps! |
You mentioned alpine morph, how can I set hx-swap=‘morph’ to work only on histore swaps but not on others? |
As far as I know, htmx uses the hx-history-elt (that is the Line 3156 in 0023cd8
Line 3179 in 0023cd8
So I don't think you can change the swap method here for history restores, but you can change the |
There is a problem now with using alpine. If a component uses ID and settles attributes by default. You must turn off settle to make it work and in this case css animations wont work correctly. |
Never used alpine so I won't be able to help that much more I'm afraid! |
One option to handle history issues with alpine may be to use the history config items like historyCacheSize=0 and refreshOnHistoryMiss=true So that it will not use htmx to store and restore history. It will then do full page loads when using back button and while it will be a little slower it will then load all alpine enabled items fresh each time |
When I've had an issue with boost I've got Alpine to listen to HTMX events, x-on:htmx:before-history-save.window="console.log('cleanup before change')" |
I wrote an extension to help with history restores that will prevent Alpine errors on back/forward navigation: https://gist.github.com/croxton/e2c33bd22591f9a5bd8c9d23a56c9edc It also helps to use inline directives over runtime declarations, for example use |
I was so hyped on alpine+htmx, but the reality is not that good 😦 I have 2 main problems 1. Id attribute cannot be swapped correctly 2. hx-boost works but history saves conflict with alpine and also with id attributes, it’s total mess and I can’t use it for real projects because of these issues
The text was updated successfully, but these errors were encountered: