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