bigskysoftware/htmx

Hx-Location docs clarification needed

Ackos95 opened this issue · 0 comments

Documentation about Hx-Location header states that behavior on the client would be the same as if user clicked on a boosted link (see bellow)

image

But when trying to use it on a project, I've found that Hx-Boosted header is not being sent with the request to the "Hx-Location". After a quick glance through the code I found that "boosted" flag is set when sending a request only based on the element that is "triggering event" (in case of redirection I'd assume elt would be document.body, which most likely won't have boost flag on it)

const eltIsBoosted = getInternalData(elt).boosted
// ....
/** @type HtmxRequestConfig */
const requestConfig = {
  boosted: eltIsBoosted,
  // ....

Should there be an exception in code for redirections, or maybe a change in the documentation removing boost references in the descriptions?

In my opinion, there should be boosted flag sent with the redirection request (after Hx-Location), with a potential discussion of how to handle Hx-Location target overrides, mainly because I think Hx-Boosted is nicely used on the back-end to decide whether to render full page template or just a partial one (e.g. isHxRequest && !isHxBoost ? renderPartial() : renderFull())