Repository navigation
fix(templates): catalog cards jump on load and icons arrive late - #199866
Conversation
The Templates catalog placeholders were a flat grid of blocks that ignored section headers and card height, so no loaded card landed where a placeholder had been. Card artwork was only requested once the cards rendered, so icons appeared a few hundred milliseconds after the text. Placeholders now mirror the loaded sections and cards, and cards reserve two title lines and two summary lines so every card has the same height. First-screen artwork is fetched and decoded before the cards are revealed, bounded at 500 ms, so icons paint in the same frame as the text.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Featured and search-result sections have no "View all" action, so their header was 3 px shorter than the placeholders and the shelves that do. A single header height replaces the hidden placeholder button, and the browser test now asserts that the first shelf and card arrive exactly where their placeholders were instead of measuring a viewport-sized grid.
|
Codex review: needs maintainer review before merge. What this changesThis PR matches Templates loading placeholders to loaded cards and preloads artwork with a 500 ms reveal budget. Example: Open Templates at 1280 px with a cold browser cache.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR addresses a verified catalog presentation defect. Both prior findings are resolved, and no new actionable defect was found; exact-head CI remains in progress. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Control UI receives public catalog entries through the Gateway, prepares their registry artwork, and renders featured shelves, category shelves, or search results. flowchart LR
A[Templates navigation] --> B[Explore request owner]
B --> C[Gateway catalog read]
C --> D[Catalog entries]
D --> E[Bounded artwork decode]
E --> F[Cards and shelves]
B --> G[Matching loading placeholders]
Technical reviewBest possible solution: Keep the existing Explore loading boundary, match its section and card geometry, and decode bounded artwork using the established image request policy. Do we have a high-confidence way to reproduce the issue? Current main renders flat placeholders independently of shelf headers and card geometry, and requests artwork only when cards render; the inspected before screenshots corroborate both symptoms. Is this the best way to solve the issue? The change fixes presentation at its existing owners, removes the superseded measurement path, and preserves request handling and image policy with explicitly accepted visual and latency tradeoffs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 6aae38f36ee8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +71, Tests +68. Total +139 across 5 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed November 15, 2026, 8:35 PM ET / November 16, 2026, 01:35 UTC (Revision 2). |
…ceiling The placeholder rules added 888 bytes to a Control UI stylesheet that is already at its fixed size ceiling, which failed the performance gate. The placeholder bars are now drawn inline and the loading wrapper reuses the results body class, so the stylesheet no longer grows.
…mmary A card without a summary dropped its summary paragraph, so it was 46 px shorter than its placeholder and moved every card below it in a one-column layout. The paragraph is now always rendered, and the browser test covers a summary-free Template on mobile.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
# Conflicts: # ui/src/pages/agents-home/templates-explore.tsx # ui/src/styles/templates-catalog.css
|
Merged via squash.
|
…nclaw#199866) * fix(templates): catalog cards jump on load and icons arrive late The Templates catalog placeholders were a flat grid of blocks that ignored section headers and card height, so no loaded card landed where a placeholder had been. Card artwork was only requested once the cards rendered, so icons appeared a few hundred milliseconds after the text. Placeholders now mirror the loaded sections and cards, and cards reserve two title lines and two summary lines so every card has the same height. First-screen artwork is fetched and decoded before the cards are revealed, bounded at 500 ms, so icons paint in the same frame as the text. * fix(templates): keep section headers one height with or without View all Featured and search-result sections have no "View all" action, so their header was 3 px shorter than the placeholders and the shelves that do. A single header height replaces the hidden placeholder button, and the browser test now asserts that the first shelf and card arrive exactly where their placeholders were instead of measuring a viewport-sized grid. * fix(templates): keep catalog placeholders within the stylesheet size ceiling The placeholder rules added 888 bytes to a Control UI stylesheet that is already at its fixed size ceiling, which failed the performance gate. The placeholder bars are now drawn inline and the loading wrapper reuses the results body class, so the stylesheet no longer grows. * fix(templates): reserve the summary lines for a Template without a summary A card without a summary dropped its summary paragraph, so it was 46 px shorter than its placeholder and moved every card below it in a one-column layout. The paragraph is now always rendered, and the browser test covers a summary-free Template on mobile.
What Problem This Solves
Fixes: the Templates catalog jumps when cards replace the loading placeholders, and card icons appear a few hundred milliseconds after the card text.
User Impact
User impact: cards now fill their placeholders in place, and first-screen icons paint in the same frame as the text.
Two visible tradeoffs:
Why This Change Was Made
The placeholders were a flat grid of blocks that ignored section headers and card height, so no loaded card landed where a placeholder had been. They now render the same section and card structure as the loaded catalog. Matching exactly requires a known card height, which is why cards reserve their title and summary lines; a matching skeleton with natural card heights still left every card out of place.
Icons were only requested once the cards rendered. The catalog now fetches and decodes the first 24 icons before revealing cards, using the same request mode as the card image so the browser reuses the response. Slow or failed icons stop holding the catalog after 500 ms and load in place as before.
Preconnecting to the registry and eager, high-priority image loading were also measured and showed no gain, so they are not part of this change.
Evidence
Measured on an isolated Gateway serving each build, against the live ClawHub catalog, entering Templates from Chat with a cold browser cache. Before is
mainat718a2f8; after is this change at1d9bf3b. Three later commits repair review and CI findings without changing that behavior:b453488gives section headers one height whether or not they have a "View all" action. Placement was rechecked on that head with the same harness (14 of 14 at 1280 px, 8 of 8 at 820 px, 5 of 5 at 400 px, 16 of 16 for a selected category).081dff2draws the placeholder bars inline instead of in the stylesheet. The first version added 888 bytes to a stylesheet that is already at its fixed size ceiling and failedcontrol-ui-performance. Against the same base the stylesheet is now 18 bytes smaller raw and 10 bytes larger gzipped, inside the 64-byte build variance.3d32dc6always renders the summary paragraph, so a Template without a summary keeps its reserved lines. Before that commit the new browser case measured the summary-free card at 83 px against a 129.5 px placeholder.The last two heads are covered by the browser test below rather than a new recording.
Placement is also exact at 820 px (8 of 8 cards) and 400 px (5 of 5 cards), three runs each, and for a selected category at 1280 and 820 px. Placement compares each loaded card and header rectangle with the placeholder rectangles from the last loading frame. The
layout-shiftobserver reports zero on both builds because the placeholders are replaced rather than moved, so it cannot show this difference.Before:
After:
Side-by-side recording, real time and then at one-fifth speed:
templates-loading-before-after.mp4
Tests and checks on
bd176f2(the branch with currentmainmerged in to resolve a conflict with #198070):templates-catalog.e2e.test.ts: 27 passed. The loading test now holds the catalog response at four viewport sizes, plus a summary-free Template on mobile, and asserts that the first shelf header and first card arrive exactly where their placeholders were. It replaces the previous assertion that a measured grid ends near the bottom of the viewport.templates-home.test.ts,templates-add.test.tsandtemplates-admission.test.ts: 53 passed. New tests cover holding the placeholders until artwork decodes or fails, and releasing them at the 500 ms budget.pnpm check:baseline-ratchetspassed locally on the merged head.pnpm check:changedpassed with the dead-export scan skipped. That scan reported unused exports insrc/state/*andui/src/lib/openclaw-id/member-welcome.ts, which this change does not touch.Known limit: when the registry is slow, the 500 ms budget expires and the cards are revealed with some icons still loading. That happened in 2 of 16 cold catalog loads across the final builds (and in 1 of 2 category loads during a slow period), and those loads show their text up to 500 ms later than
mainwould have.