New markup over an old stylesheet
Reported from a desktop browser: a stray close button beside the logo, badly drawn, and a page that would not scroll. None of it was in the code that was running -- it was the code the browser had not fetched. The worker caches /static/ under a cache named for the release while the files in it carried no version, and a page is fetched network-first. That only ever worked because the worker used to seize every open tab the instant it installed and wipe the old cache. 1.1.0 stopped it doing that, rightly -- it was swapping stylesheets out from under a streaming reply -- and a momentary mismatch became a permanent one: new markup over the previous release's CSS for as long as the old worker lived. `.sidebar__close` had no rule there, so `.btn--icon` made it inline-flex: visible everywhere, placed by nothing. Every /static/ URL carries the release now, written by `templating.asset` and precached by `sw.js:versioned` -- both halves, because caches.match compares the query too and precaching the bare path would cache entries nothing requests. Self-correcting: updating is enough. The header was also a brand with a button appended and margin-left:auto doing the placing, which holds exactly while that button is last. Two slots now: a brand that shrinks and truncates, and a rail on the trailing edge. Verified before changing anything: with the current stylesheet the button is display:none at 1280 and, with thirty chats and forty messages, both scrollers scroll. The first measurement said the thread did not -- that was scroll-behavior: smooth reporting where it started. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -324,7 +324,12 @@ def test_no_page_loads_a_script_that_the_base_template_already_loads():
|
||||
from pathlib import Path
|
||||
|
||||
templates = Path(__file__).resolve().parents[1] / "src/lembas/web/templates"
|
||||
pattern = re.compile(r"path='js/([a-z_]+\.js)'")
|
||||
# Both spellings, because the way a static URL is written has changed once
|
||||
# already: `url_for('static', path='js/x.js')` became `asset('js/x.js')`
|
||||
# when assets started carrying the release. The assertion below that the set
|
||||
# is non-empty is what turned that rename into a loud failure rather than a
|
||||
# sweep that silently stopped sweeping -- keep it.
|
||||
pattern = re.compile(r"(?:path=|asset\()'js/([a-z_]+\.js)'")
|
||||
always = set(pattern.findall((templates / "base.html").read_text()))
|
||||
assert always, "base.html stopped loading any script; this test is now blind"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user