sync: fix the broken history snapshot "restore" functionality by importing db. (#6234)

refs #6232
This commit is contained in:
Danny Hinshaw 2023-08-08 03:01:00 -04:00 committed by GitHub
parent b9c7096958
commit c46a9e4b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ import { OverlayContainer } from 'react-aria';
import { useRouteLoaderData } from 'react-router-dom';
import * as session from '../../../account/session';
import { database as db } from '../../../common/database';
import type { Snapshot } from '../../../sync/types';
import { VCS } from '../../../sync/vcs/vcs';
import { WorkspaceLoaderData } from '../../routes/workspace';
@ -95,8 +96,7 @@ export const SyncHistoryModal = ({ vcs, branch, history, onHide }: Props) => {
className="btn btn--micro btn--outlined"
onClick={async () => {
const delta = await vcs.rollback(snapshot.id, syncItems);
// @ts-expect-error -- TSCONVERSION
await db.batchModifyDocs(delta);
await db.batchModifyDocs(delta as any);
}}
>
Restore