fix(slideshow): retry init at DOMContentLoaded when the children were not parsed yet - #3750
Merged
Merged
Conversation
… not parsed yet connectedCallback defers init to a setTimeout(0) so the parser can append the element's children first. With the bundle loaded from <head>, as `hyperframes present` emits it, headless Chromium fires that timer while the parser is still inside <hyperframes-slideshow>: init finds no player or a half-streamed island, returns, and the deck never binds. While document.readyState is "loading", init now retries once at DOMContentLoaded. After parsing there is nothing to wait for, so a missing or malformed island still fails quietly as before. The subtree check is split out as locateSlideshowParts so the classification is testable without the element lifecycle.
jrusso1020
approved these changes
Sep 7, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
No blocking findings. The one-shot parser retry is bounded by readyState and guarded against stale connections (packages/player/src/slideshow/hyperframes-slideshow.ts:532); disconnect removes the listener (:312). Reconnect and parser-event ordering also check out.
Validation: all 88 slideshow tests passed locally. CI has no failures reported but several checks are still running; the manual Chromium repro was not independently repeated.
— Codex
Verdict: APPROVE
Reasoning: This narrowly fixes early initialization without changing post-parse failure behavior, and covers missing/truncated children and disconnect cleanup.
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
<hyperframes-slideshow>retriesinit()atDOMContentLoadedwhen the deferred init ran before its children were parsed.Why
connectedCallbackschedulesinit()onsetTimeout(0)and expects the parser to have appended the children by then. That holds when the page arrives in one piece, and not otherwise. Withplayer.jsandslideshow.jsloaded from<head>, which is the layouthyperframes presentemits, the page bound when served bypresent's own server, but the same HTML served by a plain static file server (python3 -m http.server) never bound in headless Chromium:init()ran on an empty subtree, returned, and the deck had no chrome and dead arrow keys. Callinginit()by hand afterwards bound it.I hit this exporting decks from Plato (a Clojure slide engine) to HyperFrames; it works around it by placing the scripts after the element.
How
locateSlideshowParts(root)classifies the subtree asreadyorincomplete(no-player,no-island,malformed-island).init()uses it in place of the inline checks.incomplete,retryInitWhenParsedarms oneDOMContentLoadedlistener, only whiledocument.readyState === "loading". Once parsing is over nothing more will arrive, so a missing or malformed island still fails quietly as before.disconnectedCallbackand guarded byinitGeneration, like the timer.Test plan
DOMContentLoadedonce the children exist, retries after a truncated island, does not arm once parsing is over, drops the retry on disconnect.vitestinpackages/player: 88 passed.typecheck,oxlint,oxfmt --check,fallowvia the pre-commit hook.presentpage over a static file server: 0.8.30 bundle never binds; this branch's bundle binds and ArrowRight advances. Served byhyperframes presentitself, both bind.