fix(docs): merge batch assets in combine job to fix client-side routing 404#264
Merged
Conversation
…ng 404 Symptom: clicking a formula on /browse/ changed the URL but showed 404; refreshing the page loaded it correctly. This is classic client-side routing failure — Vue Router fetches the route's JS chunk, the chunk 404s, the route can't render. Root cause: each build-batch job in docs.yml runs a separate VitePress build, and VitePress produces different content-hashed JS chunks per build because the page set differs (9 batches → 9 distinct app.HASH.js files, plus dist-main's own hash). The combine job only deployed dist-main's assets/, but browse HTML from each batch references batch-specific asset hashes — so every batch's browse pages referenced chunks that weren't deployed. Verified by downloading artifacts from run 27699130632: dist-main had app.CUFvjMGd.js, batches 0-8 had 9 different hashes (tggRrD32, lhlnUi-u, wADyZrW9, NxYOTzkh, TU-EUwTC, j-JEY3xz, Bh3mvEjZ, Sac3zhiF, BldWXoD6). None matched. Fix: also cp -r each batch's assets/ into dist/assets/ during the combine step. Content-hashing guarantees no filename conflicts (same content → same filename; different content → different filename). Total added payload is ~9 small duplicate-ish app chunks (~few KB each), acceptable for a static site.
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.
Problem
Clicking a formula on
/browse/changed the URL but showed 404. Refreshing the page loaded it correctly. Classic client-side routing failure.Root cause
VitePress produces different content-hashed JS chunks per build when the page set differs. Each
build-batchjob runs its ownvitepress build, so 9 batches produce 9 distinctapp.HASH.jsfiles. Thecombinejob was deployingdist-main'sassets/directory only — but browse HTML from each batch references batch-specific hashes that weren't in the deployed assets.Verified by downloading artifacts from the latest deploy (run 27699130632):
app.HASH.jshashCUFvjMGdtggRrD32lhlnUi-uwADyZrW9NxYOTzkhTU-EUwTCj-JEY3xzBh3mvEjZSac3zhiFBldWXoD6None matched. Browse HTML from batch-N references batch-N's hash, which wasn't deployed → client-side navigation 404s on the missing chunk. The SSR HTML was correct (which is why refresh worked, masking the bug).
Fix
In
docs.yml'scombinejob, alsocp -reach batch'sassets/intodist/assets/. Content-hashing guarantees no filename conflicts (same content → same filename, different content → different filename). Total added payload is ~9 small duplicate-ishapp.HASH.jschunks (~few KB each), acceptable for a static site.Verification
After merge and deploy:
https://www.fontist.org/formulas/browse//formulas/assets/app.<HASH>.jsreturns 200 (was 404)Why this was masked