fix(chat): keep remote image cards after turn-end remount - #610
Merged
RongleCat merged 1 commit intoAug 14, 2026
Merged
Conversation
Journal rehydrate remounted ImageUi with the live https src, then
swapped to the cached loopback thumb in a microtask. WKWebView aborted
the in-flight load and locked broken_blob ("preview failed") even though
the file was fine.
First-paint from the thumb cache, ignore abort/stale-src errors, and
do not wipe a working https original when thumb resolve returns empty.
Owner
|
Merged, thanks @Yy-702 — this is the right remount fix. Journal rehydrate was first-painting the live https URL, then swapping to the cached loopback thumb and locking Landed on |
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.
Why
Remote https images in assistant leftovers (e.g. a web-fetch stock chart) render while the answer is still streaming, then flip to 预览失败 — 文件可能已损坏或无法读取 (
broken_blob) as soon as the turn ends.The file is fine. Host already wrote a valid JPEG thumb under
cache/image-thumbs/. What breaks is the remount:session://journal_reconciled/ ready rehydrates the journal and remountsImageUi.https://…src.resolveChatImageThumbhits the in-memory cache and swapssrcto the loopback thumb in a microtask.<img onError>→loadFailedis locked forever.What
peekChatImageThumbwhen the session cache already has a display URL (no https → loopback swap on remount).onError(shouldApplyChatImageLoadError); remount<img>withkey={resolvedSrc}.nextChatCardDisplaySrc).Verify
pnpm exec vitest run src/lib/imageThumbClient.test.ts src/lib/mediaLoadPro.test.ts(42 passed)pnpm dev: reopen the morning-brief chat that showed the eastmoney chart; after the turn (and after switching away/back) the leftover card stays visible instead of “preview failed”.