[Glitch] Keep trying to load emojis if data isn't available yet

Port 708fe319080c92f2763e1d14fdce7bd132050237 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo 2026-05-04 11:50:24 +02:00 committed by Claire
parent 25d1f9254c
commit 5a3920215f
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;
}