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
+8 -5
View File
@@ -179,14 +179,17 @@ export function PreviewPane({ projectId, activeTab, onToggleView, isPreviewable
// Legacy refresh function for build completion events // Legacy refresh function for build completion events
const refreshIframeLegacy = useCallback(() => { const refreshIframeLegacy = useCallback(() => {
if (iframeRef.current) { if (iframeRef.current) {
// Force reload the iframe by updating its src // Force reload the iframe by updating its src with a timestamp to bust cache
iframeRef.current.src = '/'; const currentSrc = `https://${projectId}.${previewDomain}/`;
// Use a small timeout to ensure the src is cleared before setting it back const newSrc = `${currentSrc}?_refresh=${Date.now()}`;
iframeRef.current.src = newSrc;
// After a brief moment, remove the query param to clean up the URL
setTimeout(() => { setTimeout(() => {
if (iframeRef.current) { if (iframeRef.current) {
iframeRef.current.src = `https://${projectId}.${previewDomain}/`; iframeRef.current.src = currentSrc;
} }
}, 10); }, 100);
} }
}, [projectId, previewDomain]); }, [projectId, previewDomain]);