Skip to content

Commit 6883cc2

Browse files
authored
fix(electron): page history api fetch issue (#9440)
1 parent 2b47625 commit 6883cc2

File tree

1 file changed

+5
-3
lines changed
  • packages/frontend/core/src/components/affine/page-history-modal

1 file changed

+5
-3
lines changed

packages/frontend/core/src/components/affine/page-history-modal/data.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export const useDocSnapshotList = (workspaceId: string, pageDocId: string) => {
7070
};
7171

7272
const snapshotFetcher = async (
73-
[workspaceId, pageDocId, ts]: [
73+
[fetchService, workspaceId, pageDocId, ts]: [
74+
FetchService,
7475
workspaceId: string,
7576
pageDocId: string,
7677
ts: string,
@@ -79,7 +80,7 @@ const snapshotFetcher = async (
7980
if (!ts) {
8081
return null;
8182
}
82-
const res = await fetch(
83+
const res = await fetchService.fetch(
8384
`/api/workspaces/${workspaceId}/docs/${pageDocId}/histories/${ts}`
8485
);
8586

@@ -132,9 +133,10 @@ export const usePageHistory = (
132133
pageDocId: string,
133134
ts?: string
134135
) => {
136+
const fetchService = useService(FetchService);
135137
// snapshot should be immutable. so we use swr immutable to disable revalidation
136138
const { data } = useSWRImmutable<ArrayBuffer | null>(
137-
[workspaceId, pageDocId, ts],
139+
[fetchService, workspaceId, pageDocId, ts],
138140
{
139141
fetcher: snapshotFetcher,
140142
suspense: false,

0 commit comments

Comments
 (0)