diff --git a/packages/core/src/api/icons.ts b/packages/core/src/api/icons.ts index cba97f3..36c94ac 100644 --- a/packages/core/src/api/icons.ts +++ b/packages/core/src/api/icons.ts @@ -357,15 +357,10 @@ export const loadIcons: IconifyLoadIcons = ( /** * Cache for loadIcon promises */ -type LoadIconResult = Promise>; -const iconsQueue = Object.create(null) as Record; - -export const loadIcon = (icon: IconifyIconName | string): LoadIconResult => { - if (typeof icon === 'string' && iconsQueue[icon] !== void 0) { - return iconsQueue[icon]; - } - - const result: LoadIconResult = new Promise((fulfill, reject) => { +export const loadIcon = ( + icon: IconifyIconName | string +): Promise> => { + return new Promise((fulfill, reject) => { const iconObj = typeof icon === 'string' ? stringToIcon(icon) : icon; loadIcons([iconObj || icon], (loaded) => { if (loaded.length && iconObj) { @@ -380,9 +375,4 @@ export const loadIcon = (icon: IconifyIconName | string): LoadIconResult => { reject(icon); }); }); - - if (typeof icon === 'string') { - iconsQueue[icon] = result; - } - return result; };