Fix crash when resolving references without permissions (#212)

This commit is contained in:
Samy Pessé
2024-03-05 18:45:38 +00:00
committed by GitHub
parent fdaf722ba1
commit a9f9f18e66
2 changed files with 19 additions and 10 deletions
+14 -9
View File
@@ -120,16 +120,21 @@ export function cache<Args extends any[], Result>(
return cachedEntry[0].data;
}
const fetched = await revalidate(key, ...args);
console.log(
`cache: ${key} miss in ${fetched.fetchDuration.toFixed(
0,
)}ms, read in ${readCacheDuration.toFixed(
0,
)}ms, write in ${fetched.writeCacheDuration.toFixed(0)}ms`,
);
try {
const fetched = await revalidate(key, ...args);
console.log(
`cache: ${key} miss in ${fetched.fetchDuration.toFixed(
0,
)}ms, read in ${readCacheDuration.toFixed(
0,
)}ms, write in ${fetched.writeCacheDuration.toFixed(0)}ms`,
);
return fetched.data;
return fetched.data;
} catch (error) {
console.error(`cache: ${key} error: ${error}`);
throw error;
}
},
);
};
+5 -1
View File
@@ -175,8 +175,12 @@ async function resolveContentRefInSpace(spaceId: string, contentRef: ContentRef)
spaceId,
};
const [space, pages] = await Promise.all([getSpace(spaceId), getRevisionPages(pointer)]);
const result = await ignoreError(Promise.all([getSpace(spaceId), getRevisionPages(pointer)]));
if (!result) {
return null;
}
const [space, pages] = result;
return resolveContentRef(contentRef, {
content: pointer,
space,