Compare commits

...
Author SHA1 Message Date
Siddharth Singh 21b5199db6 set iframe src to actual project URL in refreshIframeLegacy 2025-12-24 02:03:36 +05:30
+9 -6
View File
@@ -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>
);
}
}