Progressive request #3345
noahfraiture
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
The article Progressive JSON has recently gained attention among content creators, and I had the idea for a similar concept in htmx. In brief, instead of receiving a complete payload in one go, a streaming response delivers data incrementally, with additional content arriving later. I recommend skimming the article for a clearer understanding.
We could envision an htmx feature where responses include an attribute, such as
hx-swap-prog
orhx-swap-progressive
, to enable this progressive loading. It might work likehx-swap-oob
and could be implemented as shown below:This approach allows responses to arrive faster, even if the full content is still being processed. For time-consuming requests, we often rely on
<script>
tags or libraries like Alpine.js to maintain responsiveness, but these cannot display partial request data until the entire response is ready. A progressive loading solution like this would address that limitation while staying true to htmx's idiomatic style.Beta Was this translation helpful? Give feedback.
All reactions