Keep trying to load emojis if data isn't available yet (#38892)
This commit is contained in:
parent
00c2089e81
commit
708fe31908
@ -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