fix(catalog): resolve assets a script loads by name - #3170
Merged
Conversation
The 3D blocks fetch their model with loader.load("models/iphone.glb"), which no
attribute or url() pattern can see, so the path survived into the payload
untouched. Inside a srcdoc iframe it resolved against the docs page and 404'd,
leaving vfx-iphone-device and ios26-liquid-glass mounted and playing with an
empty scene.
Names that resolve to a real file in the item's own directory now count as
references. They are deliberately weaker than markup references: a name that is
not a file is ignored rather than failing the item, so an ordinary string that
happens to look like a filename cannot push an item onto the video fallback.
Also clears an item's payload when a run decides it cannot build one, so the
page generator stops finding a previous run's file on disk and emitting a
player for a preview that no longer exists.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
3 tasks
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
Fixes the three 3D catalog previews that render an empty scene in production:
vfx-iphone-device,ios26-liquid-glassandmacos-tahoe-liquid-glass.Why
Those blocks load their model with
loader.load("models/iphone.glb"). The asset pass only looked atsrc=,href=andurl(), so a name passed to a function was invisible to it and the relative path went into the payload untouched. Asrcdociframe has no base URL of its own, so it resolved against the docs page and 404'd.The preview still mounted, still played, and still reported a rendered composition. Only the model was missing, which is why nothing caught it: every DOM-level check passed. It showed as an empty frame stuck at
0:00 / 0:00.How
Names that resolve to a real file inside the item's own directory now count as references. They are deliberately weaker than markup references: a name that is not a file is ignored rather than failing the item, because an ordinary string that happens to look like a filename must not push an item onto the video fallback. Markup references keep the strict behaviour, so a genuinely missing
src=still fails the item.The models are inlined rather than linked, because
.glbis one of the types the docs host does not publish.Separately, an item now loses its payload when a run decides it cannot build one. Without that, the page generator kept finding the previous run's file on disk and emitted a player for a preview that no longer existed. That is the mechanism that let a stale broken payload reach production instead of falling back to video.
Test plan
Four new cases in
scripts/catalog-payload-assets.test.tscover a model loaded by name, a lookalike string that is not a file, and that markup references still fail strictly. 24 pass.Confirmed against production first, by scanning all 164 deployed payloads for paths that resolve to nothing: exactly 2 were affected, matching the two pages reported. Screenshots of both showed an empty frame at
0:00 / 0:00. After the fix all three items embed their model, with no relative paths left in any payload.Adds ~3 MB, the three models, one copy each.