fix: make the website also work on mobile
This commit is contained in:
@ -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())];
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user