Added delay to avoid preview flashing (#19548)

This commit is contained in:
Princi Vershwal 2024-01-23 14:59:55 +05:30 committed by GitHub
parent 57810cd34e
commit 363fbd1d9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@ const PortalFrame: React.FC<PortalFrameProps> = ({href, onDestroyed, selectedTab
const makeVisible = useCallback(() => {
setTimeout(() => {
if (iframeRef.current) {
setHasLoaded(true);
setIsInvisible(false);
}
}, 100); // Delay to allow scripts to render
@ -64,7 +65,6 @@ const PortalFrame: React.FC<PortalFrameProps> = ({href, onDestroyed, selectedTab
title="Portal Preview"
width="100%"
onLoad={() => {
setHasLoaded(true);
makeVisible();
}}
/>