Short summary
The "Back to Dashboard" button in the playground header uses window.location.href = '/dashboard' instead of Next.js's router.push(), triggering a full browser page reload instead of a client-side SPA navigation.
Steps to reproduce
- Open any playground (
/playground/[id])
- Wait for the WebContainer and Monaco editor to finish loading
- Click the ← (Back to Dashboard) button in the top-left of the playground header
- Observe the browser URL bar and the page transition
Expected behavior
The app should navigate client-side to /dashboard using Next.js's App Router (router.push('/dashboard')), preserving the SPA session without a full reload.
Actual behavior
window.location.href = '/dashboard' triggers a full HTTP browser navigation. The browser:
- Discards all loaded JS bundles (Monaco Editor, WebContainer SDK, Yjs, AI state)
- Shows a white/blank flash during navigation
- Re-downloads and reinitializes the entire app from scratch
This also breaks the upcoming unsaved-changes guard (issue #427), because window.location.href bypasses any router-level navigation interceptors.
Affected area
Playground editor
Environment
All browsers, any OS. Reproducible in both local dev and production. The issue is purely in the source code at:
modules/playground/components/playground-header.tsx line 64
// Current (wrong):
onClick={() => window.location.href = '/dashboard'}
// Fix — import useRouter from 'next/navigation' and use:
onClick={() => router.push('/dashboard')}
Screenshots, logs, or recordings
Not required — the issue is visible as a full-page white flash and network waterfall showing all assets re-fetching.
Relevant code:
// modules/playground/components/playground-header.tsx:64
<Button
size="icon"
variant="ghost"
className="h-7 w-7 text-muted-foreground hover:text-foreground"
onClick={() => window.location.href = '/dashboard'} // ← problem
aria-label="Back to Dashboard"
>
Fix:
import { useRouter } from "next/navigation";
// inside component:
const router = useRouter();
// button onClick:
onClick={() => router.push('/dashboard')}
Confirmation
Short summary
The "Back to Dashboard" button in the playground header uses
window.location.href = '/dashboard'instead of Next.js'srouter.push(), triggering a full browser page reload instead of a client-side SPA navigation.Steps to reproduce
/playground/[id])Expected behavior
The app should navigate client-side to
/dashboardusing Next.js's App Router (router.push('/dashboard')), preserving the SPA session without a full reload.Actual behavior
window.location.href = '/dashboard'triggers a full HTTP browser navigation. The browser:This also breaks the upcoming unsaved-changes guard (issue #427), because
window.location.hrefbypasses anyrouter-level navigation interceptors.Affected area
Playground editor
Environment
All browsers, any OS. Reproducible in both local dev and production. The issue is purely in the source code at:
modules/playground/components/playground-header.tsxline 64Screenshots, logs, or recordings
Not required — the issue is visible as a full-page white flash and network waterfall showing all assets re-fetching.
Relevant code:
Fix:
Confirmation