feat: version static assets with deployed git SHA#48
Open
mroderick wants to merge 2 commits into
Open
Conversation
Replace the manual ?v=N cache buster on /static/auth-client.js with an automatic version derived from HEROKU_SLUG_COMMIT (set by Heroku at runtime). Falls back to SOURCE_VERSION, then 'dev' for local dev. This ensures browsers re-download static assets after every deploy without manual version bumps. Ready for future assets (CSS, images) to use the same STATIC_VERSION in their URLs.
mroderick
marked this pull request as ready for review
July 17, 2026 12:08
Fix formatting in admin.js, common.js, and home.js that was committed before prettier checks were enforced in CI. These are not related to the versioning feature but block the CI smoke job.
till
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Static assets (
/static/auth-client.js) use a manual?v=Nquery param for cache busting. Every deploy requires remembering to bump it. Browsers serve stale versions when you forget.PR #46 adds Bootstrap CSS/JS, custom CSS, and images to
static/— growing the set of files that need versioning.Solution
Derive a version stamp at app startup from Heroku's built-in env vars:
HEROKU_SLUG_COMMIT— the deployed git SHA, set automatically at runtimeSOURCE_VERSION(Heroku build-time env), thendevfor local devFirst 7 characters are used as
?v=<sha>on static URLs. Every deploy gets a new version automatically — zero configuration, zero build steps, zero dependencies.Changes
src/app/components/layout.js— addedSTATIC_VERSIONconstant, replaced hardcoded?v=2withv=${STATIC_VERSION}on the/static/auth-client.jsscript tagUsage for new assets
Any future static asset (CSS, images, etc.) in the layout uses
${STATIC_VERSION}in its URL. Example for PR #46's assets:Testing
devwhen no Heroku env vars are present (no cache busting locally, where it doesn't matter)HEROKU_SLUG_COMMIT— every deploy changes the version