Unify response processing and add hx-multipart extension#3911
Open
scriptogre wants to merge 9 commits into
Open
Unify response processing and add hx-multipart extension#3911scriptogre wants to merge 9 commits into
hx-multipart extension#3911scriptogre wants to merge 9 commits into
Conversation
hx-multipart extension
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.
Organize
ctx, and give requests and streaming extensions one swap path, one action path, and one lifecycle.Public API
Canonical response context
ctx.swapreplaces flatctx.target,ctx.swap,ctx.select,ctx.text, and related swap fields.ctx.actionsreplaces separate history and response-header state.HX-Toastbecomesactions.toastfor extensions.ctx.statusis removed. Queue admission is tracked internally asrun,queued, ordropped.Positional
htmx.swap()This replaces
htmx.swap({ text, target, swap, ... })and is closer to what we had in htmx 2.0.Shared server actions
htmx:before:actionsandhtmx:after:actions.actionstohtmx.ajax()options.pushandreplaceremain shorthands.detail.response, because actions can run without a response.Explicit response lifecycle
after:requestmeans fetch resolved. The body is still unread.after:responseexposes the body asctx.swap.content.donereplacesfinally:requestand fires once an admitted pipeline ends.hx-multipartNew extension for streaming hypermedia, alongside
hx-sseandhx-ws.One Fetch response can now stream ordered
multipart/mixedparts through same swap and action APIs.Brings a few public API changes for which I'd create an
hx-htmx-4-beta-compatextension, which should be quite lightweight.