mirror of
https://github.com/docmost/docmost.git
synced 2026-05-24 03:02:42 +08:00
Merge branch 'tiptap3-migration' of https://github.com/areknawo/docmost into tiptap3-migration
This commit is contained in:
@@ -140,10 +140,10 @@ export default function PageEditor({
|
|||||||
if (isTokenExpired) {
|
if (isTokenExpired) {
|
||||||
refetchCollabToken().then((result) => {
|
refetchCollabToken().then((result) => {
|
||||||
if (result.data?.token) {
|
if (result.data?.token) {
|
||||||
remote.disconnect();
|
socket.disconnect();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
remote.configuration.token = result.data.token;
|
remote.configuration.token = result.data.token;
|
||||||
remote.connect();
|
socket.connect();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -177,14 +177,14 @@ export default function PageEditor({
|
|||||||
// Only connect/disconnect on tab/idle, not destroy
|
// Only connect/disconnect on tab/idle, not destroy
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!providersReady || !providersRef.current) return;
|
if (!providersReady || !providersRef.current) return;
|
||||||
const remoteProvider = providersRef.current.remote;
|
const socket = providersRef.current.socket;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isIdle &&
|
isIdle &&
|
||||||
documentState === "hidden" &&
|
documentState === "hidden" &&
|
||||||
yjsConnectionStatus === WebSocketStatus.Connected
|
yjsConnectionStatus === WebSocketStatus.Connected
|
||||||
) {
|
) {
|
||||||
remoteProvider.disconnect();
|
socket.disconnect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@@ -192,7 +192,7 @@ export default function PageEditor({
|
|||||||
yjsConnectionStatus === WebSocketStatus.Disconnected
|
yjsConnectionStatus === WebSocketStatus.Disconnected
|
||||||
) {
|
) {
|
||||||
resetIdle();
|
resetIdle();
|
||||||
remoteProvider.connect();
|
socket.connect();
|
||||||
}
|
}
|
||||||
}, [isIdle, documentState, providersReady, resetIdle]);
|
}, [isIdle, documentState, providersReady, resetIdle]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user