- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Questions about hx-boost behavior #342
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
Comments
I agree, this is a bug. I have fixed it with 1a6f9b1 |
Thanks @1cg. I took a look at the fix, and seems like it's only for the swap style. What about when caching is disabled globally or when a boosted element has an ancestor with the hx attributes i mentioned? It would still break in those cases, no? |
mm good point, we should explicitly override them rather than defaulting... more work tomorrow |
OK, I looked at this a bit more. I will definitely handle the parent |
Actually, sitting here thinking about it... if a parent has an hx-swap on it, that probably should be inherited, even by boosted elements.That can be used to modify the way boosted elements swap, which is a valid use case. I'm backing off on implementing that... |
If boost works with swap, vals, target and include attributes, isn't it then just another instance of hx-get. My initial understanding of boost, which may very well be wrong, was that it would behave like a standard link, but swap the body without a page re-load, and without being affected by other hx attributes. If I need something different, then I can always use hx-get. For me, an hx-history or hx-cache attribute, that is inherited by child elements, and allows overriding (disabling) the global history configuration per request would be very useful and provide more flexibility. Or even the ability to do it within I am implementing a component-based caching approach where only the component HTML response is pushed to the browser history. Then on popstate it also replaces just the affected component. |
Using the extensions system, I wrote some functionality to implement a different history caching mechanism. To do that I also used the global htmx configuration to change the default values for:
Changing these values globally completely breaks the hx-boost functionality.
Also, if the boosted element has a parent with an
hx-target
,hx-vals
orhx-include
attributes, these are used by the boost request.While it is possible to force some of these values back to what they need to be using additional attributes:
The same is not true for the history value, since historyEnabled is global-only and cannot be controlled for individual requests/elements.
If boosting is meant to be a progressive enhancement for links and forms, and we already have the option to load HTML partials using all the other hx-[request] attributes. Shouldn't the boosting functionality remain consistent regardless of global config and parent attributes?
The text was updated successfully, but these errors were encountered: