htmx
htmx copied to clipboard
New CSS not loaded on client-side redirect even with page refresh
https://github.com/bigskysoftware/htmx/blob/b9225a53e1f33d98a2e0e57fccc132e7cc95f557/src/htmx.js#L3446C30-L3446C30
Flow: Page 1.html has CSS file A.css in the header, and an hx-swap="body" action for which the server returns a redirect response to Page 2.html
Page 2.html has CSS files A.css and B.css in the header.
No matter how I try combining 200/302 responses with/without HX-Redirect and/or HX-Refresh, when Page 2 is loaded B.css is not loaded or applied. I thought adding HX-Refresh to HX-Redirect in v1.9.6 would have resolved it but it seems not to have.
Obviously I've just worked round it - and in my case B.css was only an artefact of using a default Spring Boot framework login page to get a project started. It's odd though!
I've not had time to build a minimal replication yet but will try to shortly.
Does the head-support HTMX extension help you? If your extra CSS file is mentioned in the <head>
element, then HTMX will not process it without this extension.