diff --git a/packages/dashboard/src/index.ts b/packages/dashboard/src/index.ts index bb950d3..c49b719 100644 --- a/packages/dashboard/src/index.ts +++ b/packages/dashboard/src/index.ts @@ -144,6 +144,15 @@ export class SidequestDashboard { res.locals.basePath = this.config!.basePath ?? ""; next(); }); + + // Fixes a HTMX bug where restoring the dashboard tab from cache causes it to show an unstyled page + // https://github.com/bigskysoftware/htmx/issues/497 + this.app?.use((req, res, next) => { + if (req.headers["hx-request"]) { + res.setHeader("Cache-Control", "no-store, max-age=0"); + } + next(); + }); } /** diff --git a/packages/dashboard/src/views/layout.ejs b/packages/dashboard/src/views/layout.ejs index 18a8282..678be9e 100644 --- a/packages/dashboard/src/views/layout.ejs +++ b/packages/dashboard/src/views/layout.ejs @@ -1,5 +1,5 @@ - +