client: fix get version data

pull/60/head
fantasticit 2022-05-26 13:35:04 +08:00
parent 86d8cdac69
commit add3f93ebe
1 changed files with 1 additions and 7 deletions

View File

@ -24,7 +24,7 @@ const { Title, Text } = Typography;
export const DocumentVersion: React.FC<IProps> = ({ documentId, disabled = false, onSelect }) => {
const { isMobile } = IsOnMobile.useHook();
const [visible, toggleVisible] = useToggle(false);
const { data, loading, error, refresh } = useDocumentVersion(documentId);
const { data, loading, error, refresh } = useDocumentVersion(documentId, { enabled: visible });
const [selectedVersion, setSelectedVersion] = useState(null);
const editor = useEditor({
@ -52,12 +52,6 @@ export const DocumentVersion: React.FC<IProps> = ({ documentId, disabled = false
close();
}, [selectedVersion, close, onSelect]);
useEffect(() => {
if (visible) {
refresh();
}
}, [visible, refresh]);
useEffect(() => {
if (!editor) return;
if (!data.length) return;