Teach Versioned Immutable Asset Caching in the UI Skills - #45
Merged
Conversation
client-side-js, http-endpoints, and react-ui now teach the versionedAssets pattern from std/utils as the default way to serve client modules: the shell stamps /v<version>/ asset URLs, serve() answers them with Cache-Control: immutable (302 for stale versions), and publishing invalidates instantly. Measured: repeat visits 665ms -> 157ms with zero asset requests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 1f9738f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…mutable/<v>/ scheme Replaces the versionedAssets() factory (assets.url/assets.serve, /v<version>/ URLs) with the shipped std/utils API: free functions serveImmutableFile and immutableFileUrl, the reserved /__immutable/<version>/<path> prefix, and the frontend/root.tsx shell pattern. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Non-current /__immutable/ versions now 404 (Next.js semantics) instead of redirecting; both template routes go through serveImmutableFile. Each skill section slimmed to benefit-first sentence, minimal code, and 2 bullet nuances, with client-side-js owning the full explanation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
stevekrouse
marked this pull request as ready for review
July 30, 2026 14:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Three skills now teach the versioned-immutable asset-caching pattern (
versionedAssetsfromstd/utils) as the default way to serve client modules:client-side-jshttp-endpointsserveFilekept as unstamped fallback)react-uiPlus a changeset (patch).
Why
Per-request transpilation means every page load refetches every module. With version-stamped URLs +
Cache-Control: public, max-age=31536000, immutable, repeat visits load all assets from the browser cache: measured 665ms → 157ms with zero asset requests. Invalidation is automatic — publishing bumps the val's version, the never-cached shell stamps the new prefix, and stale URLs 302 to the current version.Prototype: https://www.val.town/x/casual_collab/asset-cache-proto
Do not merge yet
Depends on the
versioned-assetsbranch of thestd/utilsval merging first — until thenversionedAssetsis not exported fromhttps://esm.town/v/std/utils/index.ts.🤖 Generated with Claude Code