Skip to content

feat: add hash versioning for client side main.js#1656

Closed
YasharF wants to merge 1 commit into
sahat:masterfrom
YasharF:master
Closed

feat: add hash versioning for client side main.js#1656
YasharF wants to merge 1 commit into
sahat:masterfrom
YasharF:master

Conversation

@YasharF
Copy link
Copy Markdown
Collaborator

@YasharF YasharF commented May 23, 2026

Checklist

  • I acknowledge that submissions that include copy-paste of AI-generated content taken at face value (PR text, code, commit message, documentation, etc.) most likely have errors and hence will be rejected entirely and marked as spam or invalid
  • I manually tested the change with a running instance, DB, and valid API keys where applicable
  • Added/updated tests if the existing tests do not cover this change
  • README or other relevant docs are updated
  • --no-verify was not used for the commit(s)
  • npm run lint passed locally without any errors
  • npm test passed locally without any errors
  • npm run test:e2e:replay passed locally without any errors
  • npm run test:e2e:custom -- --project=chromium-nokey-live passed locally without any errors
  • PR diff does not include unrelated changes
  • PR title follows Conventional Commits — https://www.conventionalcommits.org/en

Description

Without versioning for the client-side js files, the web browser caching or proxy caching (i.e. Cloudflare) may continue serving an outdated main.js causing friction during development.

Screenshots of UI changes (browser) and logs/test results (console, terminal, shell, cmd)

N/A

Copilot AI review requested due to automatic review settings May 23, 2026 20:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cache-busting versioning to the client-side main.js include so browsers/CDNs are less likely to serve stale JavaScript after updates.

Changes:

  • Append a content-derived query parameter to /js/main.js in the main Pug layout.
  • Compute mainJsHash at server startup and expose it via app.locals for templates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
views/layout.pug Adds ?v= query param (from mainJsHash) to the main.js script tag.
app.js Computes and sets app.locals.mainJsHash by hashing public/js/main.js.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app.js
Comment thread app.js
@YasharF
Copy link
Copy Markdown
Collaborator Author

YasharF commented May 23, 2026

Added by 8aa0d99

@YasharF YasharF closed this May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants