htmx icon indicating copy to clipboard operation
htmx copied to clipboard

hx-boost wrongly creates a history record

Open gbourant opened this issue 1 year ago • 1 comments

According to the docs the following two forms should have the same functionality but it doesn't.

First of all, the documentation for hx-boost says that it won't update the history when it's used in forms but that's not the case.

The url will not be pushed, however, and no history entry will be created. (You can use the [hx-push-url] attribute if you want the url to be pushed.)
  1. If you visit localhost which contains the following form and you press the submit button the url will change to localhost/register.
<form hx-boost="true" action="/register" method="POST">
        <input name="email" id="email">
        <button type="submit">Continue</button>
</form>
  1. If i change the first form and add hx-push-url="false" it will not update the history
<form hx-boost="true" hx-push-url="false" action="/register" method="POST">
        <input name="email" id="email">
        <button type="submit">Continue</button>
</form>

gbourant avatar Feb 05 '24 19:02 gbourant

Perhaps this is bad wording just to say the url will replace the current one instead of being pushed. I don't have enough knowledge to know if that's what they meant, though. In any case, the docs should probably be updated.

nmay231 avatar Feb 08 '24 21:02 nmay231