Skip to content

Error page can't be swapped on history cache miss #3408

@friedelwolff

Description

@friedelwolff

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, 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions