썸네일이 누락된 파일 조회 및 레거시 파일 조회 네트워크 호출 최적화

This commit is contained in:
static
2026-01-15 20:33:27 +09:00
parent ebcdbd2d83
commit fe83a71a1f
16 changed files with 367 additions and 174 deletions

View File

@@ -1,6 +1,7 @@
import * as IndexedDB from "$lib/indexedDB";
import { trpc, isTRPCClientError } from "$trpc/client";
import { FilesystemCache, decryptFileMetadata, decryptCategoryMetadata } from "./internal.svelte";
import { decryptFileMetadata, decryptCategoryMetadata } from "./common";
import { FilesystemCache, type FilesystemCacheOptions } from "./FilesystemCache.svelte";
import type { FileInfo, MaybeFileInfo } from "./types";
const cache = new FilesystemCache<number, MaybeFileInfo>({
@@ -168,8 +169,12 @@ const bulkStoreToIndexedDB = (infos: FileInfo[]) => {
return infos.map((info) => [info.id, { ...info, exists: true }] as const);
};
export const getFileInfo = (id: number, masterKey: CryptoKey) => {
return cache.get(id, masterKey);
export const getFileInfo = (
id: number,
masterKey: CryptoKey,
options?: { fetchFromServer?: FilesystemCacheOptions<number, MaybeFileInfo>["fetchFromServer"] },
) => {
return cache.get(id, masterKey, options);
};
export const bulkGetFileInfo = (ids: number[], masterKey: CryptoKey) => {