Skip to content

Commit 9726eca

Browse files
committed
Fix props passed to Root in playground-preview view
Changed to use ViewProps type and pass correct props to Root component: - Changed {context} to {context: {storage}} to match other views - Changed path="/playground-preview" to url="/playground-preview" - Added ViewProps import from router.ts This fixes the "undefined is not an object (evaluating 'url.startsWith')" error in the Navbar component. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 38bb65c commit 9726eca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

website/src/views/playground-preview.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {jsx, Raw} from "@b9g/crank/standalone";
22
import {Root} from "../components/root.js";
3+
import type {ViewProps} from "../router.js";
34

45
/**
56
* Server-rendered view for playground preview iframes.
67
* This loads as a proper server route with critical scripts,
78
* then receives and executes user code via postMessage.
89
*/
9-
export default function* PlaygroundPreview({context}: {context: any}) {
10+
export default function* PlaygroundPreview({context: {storage}}: ViewProps) {
1011
const scriptContent = `
1112
// Listen for code from parent window
1213
window.addEventListener("message", async (ev) => {
@@ -101,8 +102,8 @@ export default function* PlaygroundPreview({context}: {context: any}) {
101102
<${Root}
102103
title="Playground Preview"
103104
description="Preview iframe for Crank.js playground"
104-
context=${context}
105-
path="/playground-preview"
105+
storage=${storage}
106+
url="/playground-preview"
106107
>
107108
<div id="preview-root"></div>
108109
<script type="module">

0 commit comments

Comments
 (0)