Repository navigation
fix(perf): load the chat after the page, keep the host's markdown runtime, click-to-play YouTube in markdown - #2686
Open
michaelassraf wants to merge 5 commits into
Open
michaelassraf wants to merge 5 commits into
michaelassraf wants to merge 5 commits into
Conversation
…'s markdown runtime, click-to-play YouTube iframes [preview:none] EmbeddableChat loads its code once the page has loaded and the browser is idle (afterPageLoad), or at once on an open request or open/defaultOpen, instead of during hydration on every page. An inner RichMarkdownRuntimeProvider inherits the host's runtime: filling from the defaults made every in-article image's size probe download the full original. A raw YouTube iframe in markdown renders through the Video facade; other iframes load lazily. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Contributor
🦩 Flamingo Code ReviewNot reviewed yet. Reviews start when you ask, so the reviewer reads this pull request when it is ready, not when it is opened. When it is ready:
Or comment Updated 2026-10-15 02:31 UTC · workflow run |
…; iframe snapshots gain loading=lazy [preview:none] The markdown iframe override imported isYouTubeUrl from the video module, which the golden-parity test mocks, so the check was undefined there. It lives in utils/youtube-url.ts now, used by both. The two iframe fixtures' snapshots are updated for the intended loading="lazy"; srcdoc is still stripped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…zed poster [preview:none] The card drew the full-size poster (a 1920x1080 file at 333x187, 126 KB) through the player's own poster image. It now asks the host's registered image resizer for 640px (its 320px box at 2x); the theater keeps the original, and a host with no resizer gets the original as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
michaelassraf
commented
Oct 15, 2026
…d; drop the duplicate check [preview:none] Review: the YouTube check already existed (extractYouTubeId in features/video.tsx). The markdown iframe override uses it, utils/youtube-url.ts is deleted and video.tsx is back to main. The golden test's mock of the video module keeps the module's real helpers and replaces only the player. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-lib into fix/site-lcp # Conflicts: # openframe-frontend-core/src/components/features/walkthrough-video.tsx
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.
Three lib fixes behind slow first paints on every Flamingo site (CrUX rated a 180-URL blog group Poor at LCP 4.2 s).
The chat loads after the page.
EmbeddableChatwaslazy, butlazystarts the download the moment it mounts, so on every page the chat's code downloaded and ran beside hydration although the panel starts closed. It now loads once the page has loaded and the browser is idle (newafterPageLoadutil), or at once on an open request (ask-ai:open, still held and delivered) or when the host passesopen/defaultOpen.Article images no longer download their originals.
RichMarkdownRenderermounts its ownRichMarkdownRuntimeProvider, which filled every prop the caller left out with the lib defaults, replacing the host's runtime. On the hub that turnedtransformImageSrcinto() => null, so each in-article image's 48 px size probe fell back to the full original file (170 to 470 KB each, on every markdown page). The provider now inherits the outer provider's values and uses the defaults only when there is none.A pasted YouTube iframe is click-to-play. A raw
<iframe src="https://www.youtube.com/embed/…">in markdown passed straight through and loaded YouTube's player (about 470 KB of script) with the page. It now renders through the sameVideofacade as theyoutube-embedfence; any other iframe getsloading="lazy".isYouTubeUrlis exported fromvideo.tsxfor this.Measured on the hub (local production build, mobile Lighthouse, real throttling, median of 3): a blog post with a video went from 7.18 MB to 2.35 MB; a post with two article images from 2.11 MB to 1.64 MB.
Tests: new
after-page-load.test.tsandrich-markdown-runtime.test.tsx; the markdown, embeds, features, chat and utils suites pass (1,552 tests). Checked in a browser against the hub: the chat opens from the header button with no preload, and the YouTube facade loads the player on click.The hub needs a lib release with this to get these fixes; its own half is in the linked PR.
Change-Set: fix-site-lcp
ClickUp task: CU-17tkuw5xp4q Fix poor LCP (4.2s, Poor severity) across 180-URL blog group on flamingo.run
🤖 Generated with Claude Code
Change set
flamingo-stack/openframe-oss-lib#2686: these pull requests are one change, reviewed together.Linked work
Linked by the
Depends-On/Change-Setlines in these descriptions; this block is maintained by the hub.