diff --git a/src/emoji.ts b/src/emoji.ts index b4994e4..3ad843c 100644 --- a/src/emoji.ts +++ b/src/emoji.ts @@ -37,12 +37,9 @@ const apis = { "https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/" + code.toLowerCase() + "_flat.svg", }; export type EmojiType = keyof typeof apis; -export function loadEmoji(code: string, type?: EmojiType) { +export function loadEmoji(code: string, type: EmojiType) { // https://github.com/svgmoji/svgmoji - if (!type || !apis[type]) { - type = "twemoji"; - } - const api = apis[type]; + const api = apis[type] ?? apis.twemoji; if (typeof api === "function") { return fetch(api(code)); } diff --git a/src/og.ts b/src/og.ts index fcf58fb..c825ccf 100644 --- a/src/og.ts +++ b/src/og.ts @@ -78,7 +78,7 @@ const loadDynamicAsset = (emojiType: EmojiType = "twemoji") => { } }; return async (...args: Parameters) => { - const cacheKey = JSON.stringify(args); + const cacheKey = JSON.stringify({ ...args, emojiType }); const cachedFont = assetCache.get(cacheKey); if (cachedFont) { return cachedFont;