fix: make the website also work on mobile

This commit is contained in:
2025-01-25 00:45:22 +01:00
parent 1838a25f9a
commit d8f40500bb
5 changed files with 9 additions and 8 deletions

View File

@ -6,9 +6,9 @@ interface SetCacheOptions {
expires?: number; // Override expiration for individual cache entries
}
export const caches = new Map<
const caches = new Map<
string,
{ info: () => { count: number; sizeInKB: number } }
{ info: () => { name: string; count: number; sizeInKB: number } }
>();
export function createCache<T>(
@ -96,9 +96,10 @@ export function createCache<T>(
caches.set(cacheName, {
info: api.info.bind(api),
});
return api;
}
export function getCacheInfo() {
return caches.values().map((c) => c.info());
return [...caches.values().map((c) => c.info())];
}

View File

@ -89,10 +89,10 @@ export function createCrud<T extends GenericResource>(
return;
}
const parsed = parse(content, id);
let parsed = parse(content, id);
if (hasThumbnails) {
return addThumbnailToResource(parsed);
parsed = await addThumbnailToResource(parsed);
}
const doc = { ...parsed, content };
cache.set(path, doc, { expires: 10 * 1000 });
@ -124,7 +124,6 @@ export function createCrud<T extends GenericResource>(
return;
}
const newDoc = transformDocument(content, updater);
cache.set("all", undefined);
await createDocument(path, newDoc);
}