diff --git a/app/actions/remote/custom_emoji.ts b/app/actions/remote/custom_emoji.ts index 1bdb6312d..cd034828b 100644 --- a/app/actions/remote/custom_emoji.ts +++ b/app/actions/remote/custom_emoji.ts @@ -87,10 +87,17 @@ const debouncedFetchEmojiByNames = debounce(async (serverUrl: string) => { promises.push(client.getCustomEmojiByName(name)); } - const emojis = await Promise.all(promises); - try { - await operator.handleCustomEmojis({emojis, prepareRecordsOnly: false}); + const emojisResult = await Promise.allSettled(promises); + const emojis = emojisResult.reduce((result, e) => { + if (e.status === 'fulfilled') { + result.push(e.value); + } + return result; + }, []); + if (emojis.length) { + await operator.handleCustomEmojis({emojis, prepareRecordsOnly: false}); + } return {error: undefined}; } catch (error) { return {error}; diff --git a/app/components/emoji/emoji.tsx b/app/components/emoji/emoji.tsx index 8334aea4d..299821355 100644 --- a/app/components/emoji/emoji.tsx +++ b/app/components/emoji/emoji.tsx @@ -57,7 +57,7 @@ const Emoji = (props: EmojiProps) => { } catch { // do nothing } - } else if (name && !isUnicodeEmoji(name)) { + } else if (name && (name.length > 1 || !isUnicodeEmoji(name))) { fetchCustomEmojiInBatch(serverUrl, name); } } diff --git a/app/init/app.ts b/app/init/app.ts index 76d6dd0ae..aeacf945c 100644 --- a/app/init/app.ts +++ b/app/init/app.ts @@ -16,6 +16,20 @@ import {registerNavigationListeners} from '@screens/navigation'; let alreadyInitialized = false; let serverCredentials: ServerCredential[]; +// Fallback Polyfill for Promise.allSettle +Promise.allSettled = Promise.allSettled || ((promises: Array>) => Promise.all( + promises.map((p) => p. + then((value) => ({ + status: 'fulfilled', + value, + })). + catch((reason) => ({ + status: 'rejected', + reason, + })), + ), +)); + export async function initialize() { if (!alreadyInitialized) { alreadyInitialized = true;