Keep trying to load emojis if data isn't available yet (#38892)

This commit is contained in:
Echo authored and GitHub committed 2026-05-04 09:50:24 +00:00
1 parent 00c2089e81
commit 708fe31908
3 files changed
+12 -1

No files matched your search

@@ -269,6 +269,10 @@ export async function searchCustomEmojisByShortcodes(shortcodes: string[]) {
export async function loadAllCustomEmoji() {
const db = await loadDB();
const cacheValue = await db.get('etags', 'custom');
if (!cacheValue) {
return null;
}
return db.getAll('custom');
}
@@ -28,6 +28,13 @@ export async function fetchCustomEmojiData() {
const { loadAllCustomEmoji } = await import('./database');
const emojisRaw = await loadAllCustomEmoji();
// If it returns null then custom emojis aren't even loaded yet.
if (emojisRaw === null) {
return [];
}
// If it's empty, then they are loaded but there aren't any.
if (emojisRaw.length === 0) {
customEmojis = [];
return customEmojis;
@@ -20,7 +20,7 @@ export function useCustomEmojis() {
async function loadEmojisIntoCache() {
const { loadAllCustomEmoji } = await import('../features/emoji/database');
const emojisRaw = await loadAllCustomEmoji();
if (emojisRaw.length === 0) {
if (emojisRaw === null) {
return;
}