You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[astro-icon] "mdi" failed to load at least one of the specified icons! Verify the icon names are included in the icon collection.
This issue occurs because in packages/core/src/loaders/loadIconifyCollections.ts, the code checks if all icons are loaded by comparing Object.keys(reducedCollection.icons).length with requestedIcons.length. When icon names are duplicated, the length of requestedIcons does not match the length of reducedCollection.icons, leading to a false error.
What's the expected result?
Although duplicate icon names are unnecessary, the current error message is misleading, as no icons are actually missing. Additionally, when working with large quantities of icons, it’s easy to accidentally include duplicates.
The error message could be improved to indicate the presence of duplicate icon names, or the requestedIcons could be deduplicated automatically. (Like const requestedIcons = Array.from(new Set(include[name]));)
What version of
astro-icon
are you using?v1.1.1
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When using the include option to filter specific icons, providing duplicate icon names causes an error.
This issue occurs because in packages/core/src/loaders/loadIconifyCollections.ts, the code checks if all icons are loaded by comparing
Object.keys(reducedCollection.icons).length
withrequestedIcons.length
. When icon names are duplicated, the length ofrequestedIcons
does not match the length ofreducedCollection.icons
, leading to a false error.What's the expected result?
Although duplicate icon names are unnecessary, the current error message is misleading, as no icons are actually missing. Additionally, when working with large quantities of icons, it’s easy to accidentally include duplicates.
The error message could be improved to indicate the presence of duplicate icon names, or the
requestedIcons
could be deduplicated automatically. (Likeconst requestedIcons = Array.from(new Set(include[name]));
)Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-eafrz4?file=astro.config.mjs&on=stackblitz
The text was updated successfully, but these errors were encountered: