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

This commit is contained in:
Echo 2026-05-04 11:50:24 +02:00 committed by GitHub
parent 00c2089e81
commit 708fe31908
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View File

@ -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');
}

View File

@ -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;

View File

@ -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;
}