lemon-carpenter-66863
10/08/2021, 10:26 AMicy-school-3114
10/08/2021, 12:46 PMmysterious-toddler-20573
10/08/2021, 12:48 PMmysterious-toddler-20573
10/08/2021, 12:49 PMmysterious-toddler-20573
10/08/2021, 12:49 PMmysterious-toddler-20573
10/08/2021, 12:49 PMlate-king-98305
10/08/2021, 3:17 PMmysterious-toddler-20573
10/08/2021, 3:27 PMmysterious-toddler-20573
10/08/2021, 3:28 PMlate-king-98305
10/08/2021, 3:38 PMmysterious-toddler-20573
10/08/2021, 4:01 PMadamant-exabyte-92636
10/08/2021, 5:59 PMlate-king-98305
10/08/2021, 7:19 PMadamant-exabyte-92636
10/08/2021, 7:22 PMadamant-exabyte-92636
10/08/2021, 7:24 PMlate-king-98305
10/08/2021, 7:25 PMadamant-exabyte-92636
10/08/2021, 7:31 PMadamant-exabyte-92636
10/08/2021, 7:34 PMlate-king-98305
10/08/2021, 7:36 PMmain (which is what I'm targeting with hx-swap on those links). If it's as simple as that - that will be really nice!adamant-exabyte-92636
10/08/2021, 7:41 PM<div id="nav" hx-boost="true" hx-target="#main"> That's it 🤷♂️late-king-98305
10/08/2021, 7:42 PMadamant-exabyte-92636
10/08/2021, 7:45 PM#{form _arg,
id:_id,
(_enctype ? 'hx-encoding' : 'na'):_enctype,
"hx-boost":"true",
"hx-target":"#main",
"hx-trigger":"submit" + (triggerFilter ? "[" + triggerFilter + "]" : ""),
(noValidationSpecified ? "noValidation" : "na"):_noValidation,
"script":"on htmx:responseError(xhr) call displayErrorMessage(xhr.responseText) end
on htmx:afterRequest call enableSubmit() end"}
#{doBody /}
#{/form}adamant-exabyte-92636
10/08/2021, 7:47 PMadamant-exabyte-92636
10/08/2021, 8:10 PMbillions-microphone-84331
10/08/2021, 8:42 PMhx-boost on the body, I was told before that the server could render a full HTML response (with head and so on), but it was better to just render the content of the body (the innerHTML of the body). However, this has one drawback: the <title> is not present anymore in the response, and htmx does not update the title of the page anymore. I would need to re-include the <title> alongside the content of the body, but it makes poor reusability in my templates, as I need conditional or a specific layout for that.
I think I will turn back and let the server render the full response anyway.gorgeous-ghost-95789
10/08/2021, 8:51 PMlate-king-98305
10/08/2021, 9:01 PMafterOnLoad handler updating it based on that. 🙂 I have lots of things to learn!billions-microphone-84331
10/08/2021, 9:09 PM<head>. I personally render it at the top when rendering partials, followed by potential oobs and eventually the main content for the target of the swap.billions-microphone-84331
10/08/2021, 9:22 PMhx-select in htmx). It is definitely more opinionated than htmx, but the goal seems that you can continue to send pretty much the full page on the server.
That’s why I am thinking about sending the full page most of the time (alongside with hx-boost) and only doing partials to enhance some parts of the application.
And as for the <head>, I guess it does not cost way more bytes in the response, and it avoids having to do conditionals on the server to render only the body. Your app stays more techno agnostic. In the end, htmx is for any backend tech, but I guess the opposite should also be true. Your backend tech shouldn’t be too coupled to your frontend libs...adamant-exabyte-92636
10/08/2021, 9:39 PM