perf: reduce Icon List item mount cost in widgets editor#3728
Conversation
Use lightweight SvgIcon for inherited parent icons and unselected items, resolve block editor selectors on demand in useEnter, and sync list context attributes immediately without delayed store writes. Fixes #3062 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pushed latest commit |
🤖 Pull request artifacts
|
|
Size Change: +51 B (0%) Total Size: 2.63 MB 📦 View Changed
ℹ️ View Unchanged
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe PR updates SVG ChangesIcon list editor flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The change includes the removal of the 300ms timeout for an immediate syncing. The fix persists against #3333. |
Summary
Fixes #3062 — slowdown on Appearance → Widgets when many Icon List blocks are present.
The Icon List revamp uses one
icon-list-iteminner block per line, each mounting the full Stackable edit stack. Widgets loads all widget areas at once, so hundreds of items mount together.Changes
ListItemIcon(list-item-icon.js) — lightweight icon renderingSvgIconwith<use>reference (no fullIconcomponent)SvgIconIcon(picker still works)useEnter(util.js) — removed whole-storeuseSelectsubscription; block editor selectors resolved viaselect()only on Enter keypressedit.js— immediate non-persistent sync ofordered/parentUniqueId(removed 300ms delayedsetAttributesper item on load); parent block lookup on demand for backspace mergeIcon(block-components/icon/index.js) — handle<use>SVG values in editor; show picker cursor whenopenEvenIfUnselectedExpected impact
Test plan
A. Widgets — primary regression gate (required)
develop(subjective + DevTools Performance optional)B. Icon List — inherited parent icon (most common case)
On a post and in Widgets:
Icon)C. Icon List — per-item custom icon
D. List editing behavior
developE. Ordered vs unordered
orderedattribute sync)F. Nested & transformed lists
G. Other editor contexts
H. Icon component regression (touched file)
On blocks that use
IconwithopenEvenIfUnselected(e.g. Button, Feature):<use>-based icons render (Icon List selected item with inherited def)I. Frontend parity (smoke)
Out of scope
useBlockCssGenerator/generatedCssmount cost (follow-up)Made with Cursor
Summary by CodeRabbit
Bug Fixes
New Features