fix: empty content in file modal

This commit is contained in:
Timothy Jaeryang Baek 2025-08-25 18:22:28 +04:00
parent c61698efcf
commit 630cea105e

View file

@ -13,6 +13,7 @@
import Tooltip from './Tooltip.svelte';
import dayjs from 'dayjs';
import Spinner from './Spinner.svelte';
import { getFileById } from '$lib/apis/files';
export let item;
export let show = false;
@ -49,6 +50,18 @@
item.files = knowledge.files || [];
}
loading = false;
} else if (item?.type === 'file') {
loading = true;
const file = await getFileById(localStorage.token, item.id).catch((e) => {
console.error('Error fetching file:', e);
return null;
});
if (file) {
item.file = file || {};
}
loading = false;
}
await tick();