by bottlepalm · 11mo ago · 0 comments
Unless you’re saying the components returned by HTMX are using the shadow dom for isolation, you can very easily run into styling problems by changing a style and not realizing some injected fragment of HTML somewhere relies on it being a certain way. I hope you’re using a monorepo because unlike typescript APIs, those HTML fragments and CSS styles are not type checked.
document.addEventListener('htmx:configRequest', evt => {
evt.detail.headers['Accept-Version'] = APP_VERSION;
});
And have a middleware that checks for this header. If it finds a version mismatch, have it respond with an HTTP 400 and a message to update the app to get the latest version. This is pretty similar to what many SPAs are already doing nowadays so it shouldn't come as a big surprise.Every backend framework, be it dotnet or Symphony or Rails, has a concept of components. It's a non-issue.