Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: apply higher priority for doc request (#4401)

X1a0tfeb3e6483914
diff --git a/packages/graphql/src/fetcher.ts b/packages/graphql/src/fetcher.ts
index 36f61b97e7..b660c0581c 100644
--- a/packages/graphql/src/fetcher.ts
+++ b/packages/graphql/src/fetcher.ts
@@ -217,7 +217,7 @@ export const gqlFetcherFactory = (endpoint: string) => {
export const fetchWithTraceReport = async (
input: RequestInfo | URL,
- init?: RequestInit,
+ init?: RequestInit & { priority?: 'auto' | 'low' | 'high' }, // https://github.com/microsoft/TypeScript/issues/54472
traceOptions?: { event: string }
): Promise<Response> => {
const startTime = new Date().toISOString();
diff --git a/packages/workspace/src/providers/cloud/index.ts b/packages/workspace/src/providers/cloud/index.ts
index adac93dd11..b374451d5e 100644
--- a/packages/workspace/src/providers/cloud/index.ts
+++ b/packages/workspace/src/providers/cloud/index.ts
@@ -19,7 +19,10 @@ export async function downloadBinaryFromCloud(
}
const response = await fetchWithTraceReport(
runtimeConfig.serverUrlPrefix +
- `/api/workspaces/${rootGuid}/docs/${pageGuid}`
+ `/api/workspaces/${rootGuid}/docs/${pageGuid}`,
+ {
+ priority: 'high',
+ }
);
if (response.ok) {
const arrayBuffer = await response.arrayBuffer();