mirror of https://github.com/fantasticit/think.git
client: fix get version data
parent
86d8cdac69
commit
add3f93ebe
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue