Skip to content

Commit

Permalink
fix(electron): page history api fetch issue (#9440)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 authored Dec 31, 2024
1 parent 2b47625 commit 6883cc2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export const useDocSnapshotList = (workspaceId: string, pageDocId: string) => {
};

const snapshotFetcher = async (
[workspaceId, pageDocId, ts]: [
[fetchService, workspaceId, pageDocId, ts]: [
FetchService,
workspaceId: string,
pageDocId: string,
ts: string,
Expand All @@ -79,7 +80,7 @@ const snapshotFetcher = async (
if (!ts) {
return null;
}
const res = await fetch(
const res = await fetchService.fetch(
`/api/workspaces/${workspaceId}/docs/${pageDocId}/histories/${ts}`
);

Expand Down Expand Up @@ -132,9 +133,10 @@ export const usePageHistory = (
pageDocId: string,
ts?: string
) => {
const fetchService = useService(FetchService);
// snapshot should be immutable. so we use swr immutable to disable revalidation
const { data } = useSWRImmutable<ArrayBuffer | null>(
[workspaceId, pageDocId, ts],
[fetchService, workspaceId, pageDocId, ts],
{
fetcher: snapshotFetcher,
suspense: false,
Expand Down

0 comments on commit 6883cc2

Please sign in to comment.