feat: render loading placeholder for incomplete streaming images - #604
Closed
farnabaz wants to merge 4 commits into
Closed
feat: render loading placeholder for incomplete streaming images#604farnabaz wants to merge 4 commits into
farnabaz wants to merge 4 commits into
Conversation
Incomplete images during streaming (e.g. ` now render an animated skeleton placeholder instead of being silently removed. Changes: - remend: emit `` for incomplete images instead of stripping them entirely, in both handleIncompleteUrl() and handleIncompleteText() - remend: add earlyReturn check for `streamdown:incomplete-image` marker - streamdown: ImageComponent renders animate-pulse skeleton div when src === 'streamdown:incomplete-image' - Tests updated to reflect new placeholder behavior Mirrors the existing incomplete link handling (streamdown:incomplete-link). Closes #503
Replace the streamdown:incomplete-image custom-scheme marker with a 1x1 transparent PNG data: URI. Non-http(s)/data URL schemes can be stripped by strict URL-sanitizing rehype/remark plugins (e.g. rehype-harden), which would prevent the placeholder from ever reaching the ImageComponent's src check. Addresses review feedback from @farnabaz on #504.
# Conflicts: # packages/streamdown/__tests__/image.test.tsx
Replace the shared 1x1 PNG data URI marker with streamdown:incomplete-image (link parity). Allowlist the streamdown protocol on img src in the default sanitize schema so the sentinel survives rehype-sanitize + rehype-harden, and add coverage that mirrors incomplete-link sanitize tests.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Replaces / continues #504 (fork PR — no push access to
sleitor/streamdown).Summary
streamdown:incomplete-image(parity with incomplete links), not a shared 1×1 PNG data URIstreamdownonimg[src]so the sentinel survives rehype-sanitize + rehype-hardenmain, conflict fixed inimage.test.tsxTest plan
pnpm testin remend + streamdown