mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
set iframe src to actual project URL in refreshIframeLegacy
This commit is contained in:
1 file changed
+9
-6
@@ -179,14 +179,17 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
||||
// Legacy refresh function for build completion events
|
||||
const refreshIframeLegacy = useCallback(() => {
|
||||
if (iframeRef.current) {
|
||||
// Force reload the iframe by updating its src
|
||||
iframeRef.current.src = '/';
|
||||
// Use a small timeout to ensure the src is cleared before setting it back
|
||||
// Force reload the iframe by updating its src with a timestamp to bust cache
|
||||
const currentSrc = `https://${projectId}.${previewDomain}/`;
|
||||
const newSrc = `${currentSrc}?_refresh=${Date.now()}`;
|
||||
iframeRef.current.src = newSrc;
|
||||
|
||||
// After a brief moment, remove the query param to clean up the URL
|
||||
setTimeout(() => {
|
||||
if (iframeRef.current) {
|
||||
iframeRef.current.src = `https://${projectId}.${previewDomain}/`;
|
||||
iframeRef.current.src = currentSrc;
|
||||
}
|
||||
}, 10);
|
||||
}, 100);
|
||||
}
|
||||
}, [projectId, previewDomain]);
|
||||
|
||||
@@ -904,4 +907,4 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user