mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Make refresh button actually refresh
This commit is contained in:
1 parent
02b4da72a9
commit
abe700cbc0
1 file changed
+15
-1
@@ -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) {
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={checkForBuiltProject}
|
||||
onClick={refreshIframe}
|
||||
className="h-8 w-8 p-0"
|
||||
>
|
||||
<RefreshCw className="h-4 w-4" />
|
||||
|
||||
Reference in new issue
Block a user