refactor: use fetch cache arg instead of cache busting (#3584)

This commit is contained in:
Erez Rokah
2020-04-21 17:46:06 +03:00
committed by GitHub
parent 9b79623bc8
commit 8f1b325809
147 changed files with 70994 additions and 51781 deletions

View File

@ -162,7 +162,7 @@ type ReadFile = (
options: { parseText: boolean },
) => Promise<string | Blob>;
type ReadFileMetadata = (path: string, id: string) => Promise<FileMetadata>;
type ReadFileMetadata = (path: string, id: string | null | undefined) => Promise<FileMetadata>;
type ReadUnpublishedFile = (
key: string,
@ -183,9 +183,7 @@ const fetchFiles = async (
try {
const [data, fileMetadata] = await Promise.all([
readFile(file.path, file.id, { parseText: true }),
file.id
? readFileMetadata(file.path, file.id)
: Promise.resolve({ author: '', updatedOn: '' }),
readFileMetadata(file.path, file.id),
]);
resolve({ file: { ...file, ...fileMetadata }, data: data as string });
sem.leave();