future-jewelry-30383
12/11/2022, 4:19 PMonLoad
a try and that seems to work better 👍 I'm passing a scope now to each component's init and instead of doing document.querySelector
I use scope.querySelector
to scope it down to the htmx componentbulky-librarian-91749
12/12/2022, 5:37 AMbulky-librarian-91749
12/12/2022, 5:39 AMjs
<script>
document.body.addEventListener("htmx:beforeSwap", function (evt) {
if (evt.detail.xhr.status === 204) {
//closePopUp();
}
});
</script>
bulky-librarian-91749
12/12/2022, 5:40 AMfreezing-controller-74032
12/12/2022, 9:02 AMquaint-airplane-98916
12/12/2022, 2:14 PMmysterious-toddler-20573
12/12/2022, 2:28 PMhtmx.process()
on the new content to hook it up: https://htmx.org/api/#processmysterious-toddler-20573
12/12/2022, 2:28 PMquaint-airplane-98916
12/12/2022, 2:42 PMquaint-airplane-98916
12/12/2022, 3:57 PMboundless-vase-80440
12/12/2022, 7:46 PMboundless-vase-80440
12/12/2022, 7:50 PMminiature-lizard-24702
12/12/2022, 7:52 PMwonderful-school-81222
12/12/2022, 8:53 PM<main>
content . In order to respect deep links. It seems like I need to detect the HX-Request=True to render a partial vs full page when a user interacts with the page vs wants a full render from a deep link.wonderful-school-81222
12/12/2022, 8:54 PMwonderful-school-81222
12/12/2022, 8:55 PMancient-shoe-86801
12/12/2022, 9:16 PMancient-shoe-86801
12/12/2022, 9:16 PMancient-shoe-86801
12/12/2022, 9:20 PMrequest.htmx
or a global htmx
object instead of the verbose request.headers.get('HX-Request')
). Same for generating responses. I don't know that is out there for FastAPI, though.ancient-shoe-86801
12/12/2022, 9:20 PMhigh-article-21845
12/12/2022, 9:22 PMhigh-article-21845
12/12/2022, 9:24 PMUncaught ReferenceError: htmx is not defined
at hx-echarts.js:1:1
high-article-21845
12/12/2022, 9:32 PMsalmon-kite-11112
12/12/2022, 9:51 PMwonderful-school-81222
12/12/2022, 10:10 PMwonderful-school-81222
12/12/2022, 10:10 PMwonderful-school-81222
12/12/2022, 10:11 PMwonderful-school-81222
12/12/2022, 10:12 PMwonderful-school-81222
12/12/2022, 10:12 PMmysterious-toddler-20573
12/12/2022, 10:15 PMHX-Request
header to determine if the request is from htmx or not. You can also look at the HX-Target
header if there is an id
associated w/ the target of the current request: https://htmx.org/reference/#request_headers