fix(theme): cache-bust slash-theme.css so theme changes reach existing users #27
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/theme-css-cache-busting"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #26.
The bug
root.htmlreferenced the theme stylesheet by a stable filename:and Mattermost serves
/static/with:Every other asset is content-hashed by webpack (
main.9035023454baa0d7cd87.js), so a new build invalidates it.slash-theme.cssis copied verbatim by CopyPlugin and keeps its name forever, so an existing browser keeps its cached copy for up to a year and no theme change ever reaches an already-onboarded user.How it surfaced
The AI-icon fix (#20 / PR #21) verified clean server-side — correct rule in the deployed CSS,
/static/ai-agent-icon.svgreturning 200 — while the reporting user still saw the old icon after deploy. A hard refresh fixed it instantly. The deploy had been correct the whole time.The nastier part is that this breaks verification, not just delivery: a theme change can be deployed, checked, and confirmed correct while being invisible to every existing user. Fresh browser profiles always show the new file, so testing that way actively misleads.
The fix
?bt=matches the convention already used in this codebase forremote_entry.js.compilationis a default html-webpack-plugin template parameter, so no webpack config change is needed.typeofguard is deliberate. If that parameter ever goes away, this degrades to a timestamp instead of failing the whole webapp build — which matters while PRs are not compiled (#23), because a broken template would only surface after merge.Verified that
root.htmlis genuinely EJS-processed: the built copy on the running server contains zero<%=occurrences, so the existing<%= require(...) %>directives render.Verifying after deploy
A normal refresh should be enough. Confirm the built
root.htmlcarries the query: