Refactor(Code): Optimize code

This commit is contained in:
2024-10-31 14:39:16 +08:00
parent 9c988327fd
commit 43edc9795f
2 changed files with 10 additions and 9 deletions

View File

@@ -58,15 +58,16 @@ const Render = ({ iframeKey, compiledCode, mobileMode = false }: RenderProps) =>
}
useEffect(() => {
if (isLoaded) {
iframeRef.current?.contentWindow?.postMessage(
{
type: 'UPDATE',
data: { compiledCode }
} as IMessage,
'*'
)
if (!isLoaded) {
return
}
iframeRef.current?.contentWindow?.postMessage(
{
type: 'UPDATE',
data: { compiledCode }
} as IMessage,
'*'
)
}, [isLoaded, compiledCode])
return mobileMode ? (