mirror of
https://github.com/docmost/docmost.git
synced 2026-05-19 07:54:05 +08:00
fix flicker
This commit is contained in:
@@ -355,15 +355,20 @@ export default function PageEditor({
|
|||||||
const [showStatic, setShowStatic] = useState(true);
|
const [showStatic, setShowStatic] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Wait for both connection and sync before switching from static editor
|
||||||
if (
|
if (
|
||||||
!hasConnectedOnceRef.current &&
|
!hasConnectedOnceRef.current &&
|
||||||
remoteProvider?.configuration.websocketProvider.status ===
|
remoteProvider?.configuration.websocketProvider.status ===
|
||||||
WebSocketStatus.Connected
|
WebSocketStatus.Connected &&
|
||||||
|
isLocalSynced // Also wait for local sync to complete
|
||||||
) {
|
) {
|
||||||
hasConnectedOnceRef.current = true;
|
hasConnectedOnceRef.current = true;
|
||||||
setShowStatic(false);
|
// Small delay to ensure smooth transition
|
||||||
|
setTimeout(() => {
|
||||||
|
setShowStatic(false);
|
||||||
|
}, 100);
|
||||||
}
|
}
|
||||||
}, [remoteProvider?.configuration.websocketProvider.status]);
|
}, [remoteProvider?.configuration.websocketProvider.status, isLocalSynced]);
|
||||||
|
|
||||||
if (showStatic) {
|
if (showStatic) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user