From 04ae4949e9f1c3dd6e65b106bbb1c387ff96ba6b Mon Sep 17 00:00:00 2001 From: fantasticit Date: Thu, 26 May 2022 12:59:11 +0800 Subject: [PATCH] client: fix data fetch --- .../client/src/components/document/collaboration/index.tsx | 4 +--- packages/client/src/components/document/version/index.tsx | 2 +- packages/client/src/data/document.tsx | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/client/src/components/document/collaboration/index.tsx b/packages/client/src/components/document/collaboration/index.tsx index 27a0492..7ab8951 100644 --- a/packages/client/src/components/document/collaboration/index.tsx +++ b/packages/client/src/components/document/collaboration/index.tsx @@ -51,9 +51,7 @@ export const DocumentCollaboration: React.FC = ({ wikiId, documentId, di const toastedUsersRef = useRef>([]); const { user: currentUser } = useUser(); const [visible, toggleVisible] = useToggle(false); - const { users, loading, error, addUser, updateUser, deleteUser } = useDoumentMembers(documentId, { - enabled: visible, - }); + const { users, loading, error, addUser, updateUser, deleteUser } = useDoumentMembers(documentId); const [inviteUser, setInviteUser] = useState(''); const [collaborationUsers, setCollaborationUsers] = useState([]); diff --git a/packages/client/src/components/document/version/index.tsx b/packages/client/src/components/document/version/index.tsx index 15c3782..f661135 100644 --- a/packages/client/src/components/document/version/index.tsx +++ b/packages/client/src/components/document/version/index.tsx @@ -24,7 +24,7 @@ const { Title, Text } = Typography; export const DocumentVersion: React.FC = ({ documentId, disabled = false, onSelect }) => { const { isMobile } = IsOnMobile.useHook(); const [visible, toggleVisible] = useToggle(false); - const { data, loading, error, refresh } = useDocumentVersion(documentId, { enabled: visible }); + const { data, loading, error, refresh } = useDocumentVersion(documentId); const [selectedVersion, setSelectedVersion] = useState(null); const editor = useEditor({ diff --git a/packages/client/src/data/document.tsx b/packages/client/src/data/document.tsx index ef8317c..b2f41d1 100644 --- a/packages/client/src/data/document.tsx +++ b/packages/client/src/data/document.tsx @@ -206,7 +206,7 @@ export const getDocumentVersion = ( */ export const useDocumentVersion = ( documentId, - options: UseQueryOptions> + options: UseQueryOptions> = {} ) => { const { data, error, isLoading, refetch } = useQuery( DocumentApiDefinition.getVersionById.client(documentId),