Skip to content

Commit

Permalink
chore(core): remove handling loading manually
Browse files Browse the repository at this point in the history
  • Loading branch information
CatsJuice committed Mar 27, 2024
1 parent 151d6fd commit a80a618
Showing 1 changed file with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,7 @@ const PageHistoryManager = ({
const pageDocId = useMemo(() => {
return docCollection.getDoc(pageId)?.spaceDoc.guid ?? pageId;
}, [pageId, docCollection]);
const { openConfirmModal, closeConfirmModal, setModalProps } =
useConfirmModal();
const { openConfirmModal } = useConfirmModal();

const snapshotPage = useSnapshotPage(docCollection, pageDocId, activeVersion);

Expand Down Expand Up @@ -444,27 +443,13 @@ const PageHistoryManager = ({
style: { padding: '20px 26px' },
},
confirmButtonOptions: {
loading: isMutating,
type: 'primary',
['data-testid' as string]: 'confirm-restore-history-button',
children: t['com.affine.history.confirm-restore-modal.restore'](),
},
onConfirm: () => {
setModalProps(prev => ({
...prev,
confirmButtonOptions: { ...prev.confirmButtonOptions, loading: true },
}));
handleRestore().catch(console.error).finally(closeConfirmModal);
},
onConfirm: handleRestore,
});
}, [
closeConfirmModal,
handleRestore,
isMutating,
openConfirmModal,
setModalProps,
t,
]);
}, [handleRestore, openConfirmModal, t]);

const [historyList, loadMore, loadingMore] = useDocSnapshotList(
workspaceId,
Expand Down

0 comments on commit a80a618

Please sign in to comment.