tall-dinner-62086
10/24/2022, 11:07 AMlate-king-98305
10/24/2022, 12:06 PMripe-action-67367
10/24/2022, 1:28 PMripe-action-67367
10/24/2022, 1:34 PMripe-action-67367
10/24/2022, 1:35 PMmysterious-toddler-20573
10/24/2022, 3:44 PMbitter-machine-55943
10/24/2022, 4:04 PM<head>
to stay mostly unchanged
* Ability to add a handful of page-specific elements (script, style)
* Have the new script available even on subsequent partial page loads
* Some mechanism to remove the page-specific stuff that got dynamically added, so the head
doesn’t get cluttered as the user clicks around to different “pages”
But there might be other use cases, like the default merge seems closer to a wholesale swap of head
, and I’d guess there’s a reason for that since you’ve been doing this way longer 🙂 So it’s not obvious to me that my use case should be the default.
Another idea was a head
template, so each head swap is the default head template plus whatever head elements are in the response. Or similar could be achieved by keeping everything in the original head, and having a hx-remove-me-next-head-swap
for all of the page-specific stuff. This one also solves the issue with any other dynamic head changes, like the .html-indicator
style that gets added (and potentially other libraries could break if they’re doing something similar)bitter-machine-55943
10/24/2022, 4:12 PMboundless-leather-51644
10/24/2022, 4:33 PMthankful-apartment-66679
10/24/2022, 4:36 PMmysterious-toddler-20573
10/24/2022, 4:40 PMmysterious-toddler-20573
10/24/2022, 4:40 PMmysterious-toddler-20573
10/24/2022, 4:40 PMmysterious-toddler-20573
10/24/2022, 4:40 PMmysterious-toddler-20573
10/24/2022, 4:40 PMmysterious-toddler-20573
10/24/2022, 4:40 PMmysterious-toddler-20573
10/24/2022, 4:41 PMmysterious-toddler-20573
10/24/2022, 4:41 PMboundless-leather-51644
10/24/2022, 4:47 PMthankful-apartment-66679
10/24/2022, 4:56 PMjolly-kite-167
10/24/2022, 5:51 PMcuddly-keyboard-70746
10/24/2022, 6:09 PMcuddly-keyboard-70746
10/24/2022, 6:12 PMadamant-carpet-30226
10/24/2022, 6:19 PMlate-king-98305
10/24/2022, 6:28 PMhx-swap
and hx-target
client-side values, as well as the HX-Swap
, HX-Target
, and HX-Retarget
server-generated response headers to decide how you want to handle things. For example, if your default request targets the body
of a page, you can use HX-Retarget
to target the error message placeholder on the current page if an error arises. @boundless-leather-51644
You could also do validate-on-blur; it could be a bit chatty (lots of requests), but the payloads would be small and you'd get instant feedback. As with anything web-dev, there are lots of options, and the "right answer" is usually "it depends."mysterious-toddler-20573
10/24/2022, 6:28 PMboundless-leather-51644
10/24/2022, 7:24 PMlate-king-98305
10/24/2022, 8:33 PMboundless-leather-51644
10/25/2022, 4:58 AM