Repository navigation
fix: keep cached avatars visible on session return - #1736
Merged
Merged
Conversation
Prewarm used local avatar blobs asynchronously and select changed image sources during render. Model: gpt-6.1-sol
Model: gpt-6.1-sol
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.
Related issue
Problem / pressure
Returning to a conversation can briefly replace a cached user avatar with its fallback. A cold mount keeps the original image URL visible while filling the blob cache, but the next mount uses a different, not-yet-decoded blob URL. Source changes also returned the previous hook state until an effect ran.
Summary
Preload and asynchronously decode local blobs for avatars actually used by the stable-source hook, retaining the image with its cache entry. Derive changed or newly available sources during render so they appear in the current commit. Cache reads and first paint do not await decoding; startup does not decode the whole persistent cache, and preloading adds no remote image requests.
Extend the owning suite with real
UserAvatarrendering and explicit image-load signals. Keep the authenticated profile-query path unchanged; genuinely missing profiles and completely cold images can still display the normal fallback.Visual explanation
flowchart LR A[First avatar mount] --> B[Display original URL] A --> C[Fill local blob cache] C --> D[Preload blob and decode asynchronously] D --> E[Cache entry retains warmed Image] E --> F[Return mount reuses loaded blob]Source arrival, replacement and removal select the current source during render. Background completion remains fenced to its original source.
Before / after
Test plan
pnpm checkpassed on the latest fetchedmainbase (7d6695cf3), including type-checking, lint, all test suites and boundary guards. The component suite passed 586 files / 5,739 tests; CLI passed 328 files / 4,420 tests (existing skips retained).pnpm formatand changed-file Oxfmt checks passed.UserAvatarchanges the first blob return from fallback to an immediately loaded image. Each before/after run serves one avatar HTTP request.pnpm run docs checkstill reports six existing broken links into the excluded Kimi/Pi submodules; no new documentation errors or protected-topic changes.Live deployment attribution and full-page startup performance were not measured. Completely cold images, unfinished preloading and genuinely missing profile metadata retain their normal fallback.