Skip to content

[+Extension] hx-keep, enables form and html content to persist across reloads.#3293

Open
AjaniBilby wants to merge 1 commit into
bigskysoftware:masterfrom
AjaniBilby:hx-keep
Open

[+Extension] hx-keep, enables form and html content to persist across reloads.#3293
AjaniBilby wants to merge 1 commit into
bigskysoftware:masterfrom
AjaniBilby:hx-keep

Conversation

@AjaniBilby

@AjaniBilby AjaniBilby commented Apr 26, 2025

Copy link
Copy Markdown
Contributor

I've created a library to enable forms to be cached in localStorage to allow them to survive refreshes, accidental tab closures, etc - with the server being able to then clear the cache with http hx-keep-evict header when the data is successfully saved to the server.

banner

It also provides client side APIs to allow frontends like react to hook into it to store their state in a form for custom input elements.

HTML attribute prefix used: hx-keep* (with support for data- prefix)
Respects hx-history="false"

@AjaniBilby

Copy link
Copy Markdown
Contributor Author

This does have some overlap with the behaviour of hx-preserve, however hx-keep has nothing to do with element state like video - it only considers the raw html or FormData.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant