fix flicker

This commit is contained in:
Philipinho
2025-08-03 19:01:28 -07:00
parent 6f83f32d5c
commit 0e1d4e5eee
@@ -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 (