Skip to content

[6.x] Speed up rendering icons by only importing each one once - #15766

Merged
duncanmcclean merged 2 commits into
6.xfrom
load-icons-once
Nov 2, 2026
Merged

duncanmcclean merged 2 commits into
6.xfrom
load-icons-once

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request speeds up rendering pages with lots of icons, like entries with large Bard or Replicator fields.

Every <ui-icon> instance dynamically imported its SVG, even when the same icon had already been loaded. Vite's preload helper runs a document.querySelector() for each of a chunk's dependencies on every dynamic import, which gets expensive on a big page. On a customer's entry (~40k DOM nodes, ~1,400 Bard toolbar buttons), it added up to ~0.5 seconds, and was why Bard's toolbar icons appeared a couple of seconds after the editors.

This PR fixes it by remembering each icon's import, so it only happens once per icon. A failed import is forgotten, so it can be retried.

Related: #13385

@duncanmcclean duncanmcclean changed the title [6.x] Import each icon once [6.x] Speed up rendering icons by only importing each one once Nov 2, 2026
@duncanmcclean
duncanmcclean merged commit 9b80b83 into 6.x Nov 2, 2026
65 checks passed
@duncanmcclean
duncanmcclean deleted the load-icons-once branch November 2, 2026 16:55
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