[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:
parent
25d1f9254c
commit
5a3920215f
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user