Skip to content

[UEPR-546] Use configurable assetHost for library asset thumbnails#578

Draft
adzhindzhi wants to merge 1 commit into
scratchfoundation:developfrom
adzhindzhi:uepr-546-use-scratch-storage-for-fetching-library-thumbnails
Draft

[UEPR-546] Use configurable assetHost for library asset thumbnails#578
adzhindzhi wants to merge 1 commit into
scratchfoundation:developfrom
adzhindzhi:uepr-546-use-scratch-storage-for-fetching-library-thumbnails

Conversation

@adzhindzhi
Copy link
Copy Markdown
Contributor

@adzhindzhi adzhindzhi commented May 21, 2026

Resolves

UEPR-546

Proposed Changes

  • Removе the hardcoded assetServiceUri field from the objects returned by getItemIcons() and from ScratchImage props
  • Remove the platform check that rendered a plain <img src={assetServiceUri}> on web. All platforms now go through <ScratchImage>, with the platform prop passed through so ScratchImage can adjust its behaviour.
  • Add platform-based parallelism for ScratchImage: web sets _maxParallelism = Infinity (no cap), while desktop/Android keeps 6 (loading up to 6 parallel items on web adds a significant visual delay compared to previous behavior)
  • Replace the VisibilitySensor render-prop pattern, which called loadPendingImages() on every render, with the onChange callback, which fires only when visibility actually changes.
  • Add a static _assetCache Map so assets already fetched in a session are served from memory on subsequent requests.
  • Маke sure icon rotation works as expected with the updated logic

Reason for Changes

Library thumbnail URLs were hardcoded to https://cdn.assets.scratch.mit.edu, making the asset host non-configurable and bypassing the scratch-storage layer entirely. This meant the assetHost prop passed to the GUI had no effect on library thumbnails, making other platforms unable use a different asset host. Routing everything through scratch-storage's registered web stores makes the host fully configurable via the standard assetHost prop.

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.

1 participant