From d1f7063d4882bedc62545a8e1f291beaa8fef3f8 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 20 Jul 2025 14:10:52 -0500 Subject: [PATCH] Make refresh button actually refresh --- src/components/Shakespeare/PreviewPane.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/Shakespeare/PreviewPane.tsx b/src/components/Shakespeare/PreviewPane.tsx index aa9bf2f4..d8090572 100644 --- a/src/components/Shakespeare/PreviewPane.tsx +++ b/src/components/Shakespeare/PreviewPane.tsx @@ -99,6 +99,20 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) { } }, [projectId]); + const refreshIframe = useCallback(() => { + if (iframeRef.current) { + // Force reload the iframe by updating its src + const currentSrc = iframeRef.current.src; + iframeRef.current.src = ''; + // Use a small timeout to ensure the src is cleared before setting it back + setTimeout(() => { + if (iframeRef.current) { + iframeRef.current.src = currentSrc; + } + }, 10); + } + }, []); + const sendResponse = useCallback((message: JSONRPCResponse) => { if (iframeRef.current?.contentWindow) { console.log(`Sending response to iframe:`, message); @@ -269,7 +283,7 @@ export function PreviewPane({ projectId, activeTab }: PreviewPaneProps) {