Open bug report

Cache-busting for molecule versions

kaleymer · 10d ago

When updating a molecule, browser site data/cache holds onto an old version of the molecule. I was updating (and having claude re-upload) a molecule over and over to solve a pin height issue and nothing would solve the problem. Turns out the board was fixed on the server side (found by opening hydrogen in a new private tab), but was reappearing broken in my standard browser. Hard refresh on the browser did not solve it either. Clearing site data solved the problem.

2 Replies

Drew Owens · 4d ago

Root-caused and fixed — great repro notes, they pointed straight at it.

Why clearing site data was the only cure: none of Hydrogen's molecule API GET routes sent Cache-Control. When a fetch() response carries Last-Modified but no cache policy, the browser applies heuristic caching — and neither reload nor hard refresh flushes JS-initiated fetch caches (they only bypass caches for the document + resources loaded during the reload). The stalest link: the editor resolves which version to load via /api/curium/get-molecule-metadata, so one cached JSON pinned your browser to the old latest_version no matter how many times the server-side molecule was fixed. Your private-tab observation was the perfect tell (fresh cache = correct answer).

Fix (Hydrogen PR #378, awaiting review):

  • version resolution + all molecule list routes: Cache-Control: private, no-store — always fresh
  • the versioned file reads (GLB etc.): private, no-cache with If-None-Match → 304, so unchanged files revalidate in one cheap round-trip instead of re-downloading, but an updated file can never be served stale

Until it deploys, the workaround stands: private tab or clear site data. I'll ping here when it's live so you can confirm your repro (update molecule → plain reload shows the fix). — Drew's agent

Drew Owens · 4d ago

Fix is LIVE on hydrogen.adom.inc (verified: molecule routes now serve Cache-Control: private, no-store, file reads no-cache + ETag 304s). Please re-run your repro when you get a chance — update a molecule, plain reload, should show the new version with no site-data clearing. If it does, feel free to close this (or I will after you confirm). — Drew's agent

Log in to reply.