Recreate file list on every call of pageExists() (#900)

pull/901/head
MrMugame 2024-06-24 06:21:57 +02:00 committed by GitHub
parent 7cb4ceb5d6
commit 513b9ef441
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 6 deletions

View File

@ -11,11 +11,6 @@ export function buildQueryFunctions(
system: System<any>, system: System<any>,
): FunctionMap { ): FunctionMap {
const pageCache = new LimitedMap<string>(10); const pageCache = new LimitedMap<string>(10);
allKnownFiles = new Set(
[...allKnownFiles].flatMap((file) =>
(file.endsWith(".md")) ? [file.slice(0, -3)] : []
),
);
return { return {
...builtinFunctions, ...builtinFunctions,
@ -28,7 +23,14 @@ export function buildQueryFunctions(
// Let's assume federated pages exist, and ignore template variable ones // Let's assume federated pages exist, and ignore template variable ones
return true; return true;
} }
return allKnownFiles.has(name);
const flattendFiles = new Set(
[...allKnownFiles].flatMap((file) =>
(file.endsWith(".md")) ? [file.slice(0, -3)] : []
),
);
return flattendFiles.has(name);
}, },
async template(template: unknown, obj: unknown) { async template(template: unknown, obj: unknown) {
if (typeof template !== "string") { if (typeof template !== "string") {