Skip to content

Fix HX-Location replace option - #3939

Open
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/fix-hx-location-replace
Open

Fix HX-Location replace option#3939
scriptogre wants to merge 1 commit into
bigskysoftware:four-devfrom
scriptogre:4.0/fix-hx-location-replace

Conversation

@scriptogre

@scriptogre scriptogre commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

replace is ignored because HX-Location always adds the default push option:

HX-Location: {"path":"/dashboard","replace":"/dashboard"}
Expected: replace the current history entry
Actual:   push a new history entry

The same format check misclassifies URLs with commas and minimal HCON:

Value Expected Actual
/files/a,b Plain URL HCON
path:/search HCON Plain URL

Changes

  1. Default to push: 'true' only when push and replace are absent.

  2. Use parsed path to distinguish HCON from a plain URL:

    /files/a,b    -> /files/a,b
    path:/search  -> { path: '/search' }
    
  3. Rewrite the HX-Location reference page.

  4. Add regression tests.

@scriptogre scriptogre changed the title Honor HX-Location replace option Fix HX-Location replace option Aug 1, 2026
@scriptogre
scriptogre force-pushed the 4.0/fix-hx-location-replace branch from 21fff72 to 56afab7 Compare August 1, 2026 12:59
@scriptogre
scriptogre force-pushed the 4.0/fix-hx-location-replace branch from 56afab7 to 0e67c15 Compare August 1, 2026 13:09
@scriptogre scriptogre added bug Something isn't working documentation Improvements or additions to documentation htmx 4 Issues specific to htmx version 4 labels Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation htmx 4 Issues specific to htmx version 4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant