Skip to content

The mobile shell is pinned to the visual viewport, and a deploy is never cached - #332

Merged
mattshax merged 1 commit into
mainfrom
cache-headers
Sep 8, 2026
Merged

The mobile shell is pinned to the visual viewport, and a deploy is never cached#332
mattshax merged 1 commit into
mainfrom
cache-headers

Conversation

@mattshax

@mattshax mattshax commented Sep 8, 2026

Copy link
Copy Markdown
Member

Two faults, and the first hid the second.

Caching. Every static file was served public, max-age=0: a phone could hold a stale shell after a deploy, while two megabytes of fingerprinted JavaScript were revalidated on every load. @fastify/static writes that header itself after any setHeaders hook, so cacheControl: false is required for ours to stand. Now /assets/* (content-hashed names) is public, max-age=31536000, immutable and the HTML shell is no-store, must-revalidate, so a deploy is picked up on the next load with nothing to clear. Verified on the live server.

Mobile shell. The layout asked a chain of percentage heights to agree with a viewport that changes size as iOS slides its toolbars; it did not, so the bottom bar left the screen and the thread ran under the browser chrome. .app is now position: fixed; inset: 0; height: 100dvh under the 760px breakpoint, which is the arrangement iOS keeps correct through that transition. Out of flow, the page has nothing to scroll and the bottom bar cannot be carried away; views scroll inside themselves as before. Confirmed present in the built CSS.

… is never cached

Two faults, and the first hid the second. Static files were all served
with max-age=0, so a phone could hold a stale shell after a deploy while
two megabytes of fingerprinted JavaScript were revalidated on every
load. The plugin writes that header itself after any setHeaders hook, so
its own handling is now off: a file under assets carries its content
hash and is cached for a year and never revalidated, and the HTML shell
that names those files is never cached, so a deploy lands on the next
load with nothing to clear.

The phone layout asked a chain of percentage heights to agree with a
viewport that changes size as iOS slides its toolbars, and it did not:
the bottom bar left the screen and the thread ran under the browser
chrome. The app is now a fixed element pinned to the visual viewport,
which is the one arrangement iOS keeps correct through that transition.
Out of flow, the page has nothing to scroll, and each view scrolls
inside itself.
@mattshax
mattshax merged commit 9dd7b4d into main Sep 8, 2026
1 check passed
@mattshax
mattshax deleted the cache-headers branch September 8, 2026 03:47
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.

1 participant