bigskysoftware / bigskysoftware/htmx

Error page can't be swapped on history cache miss

Open
#3,408 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
49.4k
Forks
1.7k
Avg merge
3d 22h
Merged PRs (30d)
30

Description

As of HTMX 2.0.6, in case of a history cache miss `loadHistoryFromServer()` [checks if the xhr status code falls between 200 and 400](https://github.com/bigskysoftware/htmx/blob/599d152c484cd351aad91159c3dae3c40095fb49/src/htmx.js#L3305), and any error codes (>=400) triggers `htmx:historyCacheMissLoadError`. As far as I can see, this makes it impossible to return with a legitimate, informative error page with the semantically correct HTTP code and have any of the content swapped in.

In my specific situation, I allow swapping of error pages with `responseHandling` in the config, but `codeMatches()` is never used in `loadHistoryFromServer()`.

Is this a bug or intended behaviour? Any advice or something obvious I missed?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.