Open
Conversation
64e1669 to
6194027
Compare
6194027 to
a2282e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes HTMX fragments work with auto-refresh.
This PR is based on the autorefresh-with branch because it modifies the auto-refresh implementation, but it’s independent and could be rebased onto master.
What
Add utilities to improve HTMX integration and make auto-refresh work with HTMX fragments.
Why
Using HTMX with ihp was difficult to debug because the existing helpers.js intercepts form submissions and does some unexpected stuff. It turns out helpers.js is easily replaceable with a full HTMX-based approach using hx-boost and HTMX morphdom.
Auto-refresh is a fantastic feature, but before this PR it could only refresh the entire page. As the app grows,
it becomes harder to split pages into multiple components, and auto-refresh gets more resource-intensive since it re-renders the whole page for every small change.
It is also useful for small live UI elements like a header notification badge. On relevant DB changes (e.g. another user creates content in the workspace), only that HTMX fragment is re-rendered.
Related: #1807
here is a demo project that show the usage: https://github.com/vcombey/test-autorefresh-htmx