Skip to content

Conversation

AjaniBilby
Copy link
Contributor

@AjaniBilby AjaniBilby commented Apr 26, 2025

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