multithreaded: keep 4xx and 5xx out of the swap under htmx 4
Finishes the htmx 4 move here. The bundle and the event renames landed with the
server's; what was left is the one behaviour change that actually reaches this
app.
htmx 4 swaps every response but 204 and 304. The only htmx-driven element in
multithreaded is the search box, and a failed /search answers with a whole
rendered error page (src/error_page.rs), so the default would paint that page
inside #search-results. base.html states noSwap for 4xx and 5xx above the script
tag, since htmx reads the config once as it runs. The toast in mt.js is again the
whole response to an error, which is what 2.x gave; htmx fires
htmx:response:error before the noSwap check, so that handler is untouched.
Checked and left alone: the search box's hx-get, hx-trigger and hx-swap all mean
what they meant. hx-swap="innerHTML" is 4's default, and an input with a name
still contributes its own value to a GET that it issues itself, so no hx-include
is owed. No hx-push-url anywhere, so the history cache the server had to restore
is not needed here.
Co-Authored-By
Claude Opus 5 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-08-20 17:35 UTC
- `session_user: Option<TemplateSessionUser>`: for header login state
139
139
- `mnw_base_url: Arc<str>`: for links back to MNW
140
140
141
+
### htmx
142
+
143
+
`static/htmx.min.js` is htmx 4.0.0-beta6, the same vendored bundle the MNW server carries. Events are `htmx:phase:action` (`htmx:before:request`, `htmx:config:request`, `htmx:response:error`, `htmx:finally:request`), and the request lives on `evt.detail.ctx` rather than spread across the detail: the element that made the request is `ctx.sourceElement` and outgoing headers are `ctx.request.headers`.
144
+
145
+
`base.html` sets `<meta name="htmx-config" content='{"noSwap":[204,304,"4xx","5xx"]}'>` above the script tag. htmx 4 swaps every response by default, and this app's error paths answer with a whole rendered page (`src/error_page.rs`), so without it a failed request paints an error page inside whatever the request targeted. htmx reads the meta once as the script runs, so it has to stay above `_head_assets.html`.
146
+
141
147
## Database Layer
142
148
143
149
Queries and mutations live in `crates/mt-db/`. Same sqlx patterns as MNW server: