mirror of https://github.com/fantasticit/think.git
fix: fix the moment to delete provider
This commit is contained in:
parent
344cc5b05c
commit
5540c0dfab
|
@ -65,6 +65,9 @@ export const Editor: React.FC<IProps> = ({ user: currentUser, documentId, author
|
|||
onSynced() {
|
||||
toggleLoading(false);
|
||||
},
|
||||
onStatus({ status }) {
|
||||
setStatus(status);
|
||||
},
|
||||
},
|
||||
});
|
||||
}, [documentId, currentUser, toggleLoading]);
|
||||
|
@ -85,22 +88,15 @@ export const Editor: React.FC<IProps> = ({ user: currentUser, documentId, author
|
|||
//
|
||||
}
|
||||
}, 50),
|
||||
onDestroy() {
|
||||
destoryProvider(provider, 'EDITOR');
|
||||
},
|
||||
},
|
||||
[authority, provider]
|
||||
);
|
||||
const [mentionUsersSettingVisible, toggleMentionUsersSettingVisible] = useToggle(false);
|
||||
const [mentionUsers, setMentionUsers] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
provider.on('status', async ({ status }) => {
|
||||
setStatus(status);
|
||||
});
|
||||
|
||||
return () => {
|
||||
destoryProvider(provider, 'EDITOR');
|
||||
};
|
||||
}, [documentId, provider, authority]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!authority || !authority.editable) return;
|
||||
|
||||
|
|
|
@ -64,13 +64,10 @@ export const Editor: React.FC<IProps> = ({ user, documentId, document, children
|
|||
// @ts-ignore
|
||||
taskItemClickable: true,
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
onDestroy() {
|
||||
destoryProvider(provider, 'READER');
|
||||
};
|
||||
}, [provider]);
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<DataRender
|
||||
|
|
Loading…
Reference in New Issue