mirror of https://github.com/fantasticit/think.git
client: fix data fetch
parent
0fd93c31e6
commit
04ae4949e9
|
@ -51,9 +51,7 @@ export const DocumentCollaboration: React.FC<IProps> = ({ wikiId, documentId, di
|
||||||
const toastedUsersRef = useRef<Array<IUser['id']>>([]);
|
const toastedUsersRef = useRef<Array<IUser['id']>>([]);
|
||||||
const { user: currentUser } = useUser();
|
const { user: currentUser } = useUser();
|
||||||
const [visible, toggleVisible] = useToggle(false);
|
const [visible, toggleVisible] = useToggle(false);
|
||||||
const { users, loading, error, addUser, updateUser, deleteUser } = useDoumentMembers(documentId, {
|
const { users, loading, error, addUser, updateUser, deleteUser } = useDoumentMembers(documentId);
|
||||||
enabled: visible,
|
|
||||||
});
|
|
||||||
const [inviteUser, setInviteUser] = useState('');
|
const [inviteUser, setInviteUser] = useState('');
|
||||||
const [collaborationUsers, setCollaborationUsers] = useState([]);
|
const [collaborationUsers, setCollaborationUsers] = useState([]);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ const { Title, Text } = Typography;
|
||||||
export const DocumentVersion: React.FC<IProps> = ({ documentId, disabled = false, onSelect }) => {
|
export const DocumentVersion: React.FC<IProps> = ({ documentId, disabled = false, onSelect }) => {
|
||||||
const { isMobile } = IsOnMobile.useHook();
|
const { isMobile } = IsOnMobile.useHook();
|
||||||
const [visible, toggleVisible] = useToggle(false);
|
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 [selectedVersion, setSelectedVersion] = useState(null);
|
||||||
|
|
||||||
const editor = useEditor({
|
const editor = useEditor({
|
||||||
|
|
|
@ -206,7 +206,7 @@ export const getDocumentVersion = (
|
||||||
*/
|
*/
|
||||||
export const useDocumentVersion = (
|
export const useDocumentVersion = (
|
||||||
documentId,
|
documentId,
|
||||||
options: UseQueryOptions<Array<{ version: string; data: string; createUser: IUser }>>
|
options: UseQueryOptions<Array<{ version: string; data: string; createUser: IUser }>> = {}
|
||||||
) => {
|
) => {
|
||||||
const { data, error, isLoading, refetch } = useQuery(
|
const { data, error, isLoading, refetch } = useQuery(
|
||||||
DocumentApiDefinition.getVersionById.client(documentId),
|
DocumentApiDefinition.getVersionById.client(documentId),
|
||||||
|
|
Loading…
Reference in New Issue