fix(preview): re-trigger dev server ensure check when user clicks refresh button
This commit is contained in:
@@ -153,6 +153,18 @@ export default function PreviewTab() {
|
||||
const deviceMode = usePreviewToolbarStore((s) => s.deviceMode);
|
||||
const refreshKey = usePreviewToolbarStore((s) => s.refreshKey);
|
||||
|
||||
// When the user clicks the manual refresh button in the toolbar, we don't
|
||||
// just want to reload the iframe — we also want to trigger the same ghost/zombie
|
||||
// check as the initial mount, in case the server died while they were looking at it.
|
||||
const prevRefreshKeyRef = useRef(refreshKey);
|
||||
useEffect(() => {
|
||||
if (refreshKey === prevRefreshKeyRef.current) return;
|
||||
prevRefreshKeyRef.current = refreshKey;
|
||||
|
||||
// Reset the ensure called flag so the ensure effect (below) fires again.
|
||||
ensureCalledRef.current = false;
|
||||
}, [refreshKey]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
setIframeSrc(primaryRunning?.url ?? null);
|
||||
}, [primaryRunning?.url]);
|
||||
|
||||
Reference in New Issue
Block a user