[object Object]

← back to Wallco Ai

PDP: mtime cache-bust /js/color-dots.js so JS fixes land on normal reload (no hard-refresh) across injected + all 17 theme includes

ad8604f562ae803ed93c57c5e4b8409960a0e911 · 2026-06-02 08:41:33 -0700 · Steve Abrams

Files touched

Diff

commit ad8604f562ae803ed93c57c5e4b8409960a0e911
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jun 2 08:41:33 2026 -0700

    PDP: mtime cache-bust /js/color-dots.js so JS fixes land on normal reload (no hard-refresh) across injected + all 17 theme includes
---
 server.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server.js b/server.js
index 68e71d9..73ead3c 100644
--- a/server.js
+++ b/server.js
@@ -136,6 +136,13 @@ try { require('./src/social').mount(app); } catch (e) { console.error('Social mo
 
 // Inject the universal share layer onto the designs grid + every design page.
 // Done as a response rewrite so the 863KB server.js page templates stay untouched.
+let _cdVer = null;
+function colorDotsVer() {
+  if (_cdVer) return _cdVer;
+  try { _cdVer = String(Math.floor(require('fs').statSync(path.join(__dirname, 'public', 'js', 'color-dots.js')).mtimeMs)); }
+  catch (e) { _cdVer = '1'; }
+  return _cdVer;
+}
 app.use((req, res, next) => {
   const isPDP = /^\/design\/\d+$/.test(req.path);
   if (req.path === '/designs' || isPDP) {
@@ -149,6 +156,10 @@ app.use((req, res, next) => {
         // grid isn't a theme; per-card dots would clutter it).
         if (isPDP && body.indexOf('color-dots.js') === -1) inj += '<script src="/js/color-dots.js" defer></script>\n';
         if (inj) body = body.replace('</body>', inj + '</body>');
+        // Cache-bust color-dots.js by its mtime so JS fixes land on a normal
+        // reload (no hard-refresh). Covers the injected include AND the ~17
+        // hardcoded theme-variant includes in one place. (?!\?) avoids double-tag.
+        if (isPDP) body = body.replace(/\/js\/color-dots\.js(?!\?)/g, '/js/color-dots.js?v=' + colorDotsVer());
       }
       return origSend(body);
     };

← 3535426 color-dots: Save targets the last-recolored image, not the t  ·  back to Wallco Ai  ·  pilot-build-tifs.py: --all batch mode (published ids, disk g 7b073e5 →