Skip to content

fix(native-list): show cached Web row images immediately - #348

Merged
huhuanming merged 2 commits into
mainfrom
fix/native-list-web-cached-image-reveal
Nov 28, 2026
Merged

huhuanming merged 2 commits into
mainfrom
fix/native-list-web-cached-image-reveal

Conversation

@huhuanming

@huhuanming huhuanming commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Show NativeList Web row images right away when they are already cached. createImage kept every new <img> at opacity 0 until its load event fired. A memory-cache hit is already complete as soon as src is set, but its load event is a queued task. While a modal mounts a list the main thread is busy, so the event runs late and the image stays invisible.

On the OneKey desktop app (6.8.0), reopening the aggregated token details modal (OK-68237) rendered the Asset allocation rows with every network logo already complete=true but at opacity 0 for about 117 ms, measured per frame over CDP. The user's recording shows longer gaps. createImage now sets opacity to 1 at once for such images. Images that still have to load keep the existing fade. The source shown during setup is remembered, so its queued load event does not fade it in again, even when it runs after the 100 ms threshold; this covers row images, thumbnails and selector backgrounds. A later retry or fallback source still fades.

iOS and Android already show memory-cache hits synchronously (OneKeyImage.identityDidChange / showMemoryCachedPreviewBeforeLayout) and skip the fade for them, so this brings Web in line. The spec now states this rule.

Validation

  • Regression test: a cache-hit row image is visible without a load event and does not fade when that event arrives 500 ms later; the same holds for a selector-row background; a non-cached image that loads after 500 ms still fades. Both cache-hit cases fail without the guard.
  • NativeList.web.test.ts: 210/210 passed. tsc -b, eslint (0 errors), prettier, test integrity and git diff --check passed.
  • The full native-list Jest run has 32 failures in NativeList.ref.test.tsx. They are identical with and without this change (compared via --json).
  • Not yet verified in a desktop build with this package; the App needs a published version first.

🤖 Generated with Claude Code

A row image that is already complete when its source is set is a memory-cache hit, but createImage kept it at opacity 0 until its queued load event fired. While a modal mounts a list the main thread is busy, so cached network logos in the desktop aggregated token details stayed blank for 100 ms or more (OK-68237). Reveal such images synchronously; iOS and Android already do.
@sidmorizon

Copy link
Copy Markdown
Contributor

@codex review

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex security review

@sidmorizon

Copy link
Copy Markdown
Contributor

Cursor review failed.

Remote error: cursor_permission_denied: HTTP 403 Forbidden: Cloud Agent is not available for free users. Please upgrade to Pro.

@cursor

cursor Bot commented Nov 28, 2026

Copy link
Copy Markdown

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T14:13:10.722819Z cf41cae Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Unknown error
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidmorizon

Copy link
Copy Markdown
Contributor

Devin Cloud review ↗

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: cf41cae56a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidmorizon

Copy link
Copy Markdown
Contributor

A cache-hit image is shown during setup, but its queued load event still called revealWebImage. When that event ran more than 100 ms after creation (a busy modal mount) the image or its selector background faded in again from opacity 0. Remember the source shown during setup and skip the fade for it in both load handlers; a later retry or fallback source still fades.
@huhuanming
huhuanming merged commit 3a5cc25 into main Nov 28, 2026
17 checks passed
@huhuanming
huhuanming deleted the fix/native-list-web-cached-image-reveal branch November 28, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants