Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 992d1e3

Browse files
author
Je
committed
breaking: update custom app props to allow inject props to page component
1 parent fc551c4 commit 992d1e3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export function ALEPH({ initial }: {
143143
}
144144
}, [manifest])
145145

146-
const pageEl = React.createElement(page.Component || e404.Component)
146+
const Page = page.Component || e404.Component
147147
return React.createElement(
148148
AppManifestContext.Provider,
149149
{ value: manifest },
@@ -153,7 +153,7 @@ export function ALEPH({ initial }: {
153153
React.createElement(
154154
RouterContext.Provider,
155155
{ value: page.url },
156-
app.Component ? React.createElement(app.Component, null, pageEl) : pageEl
156+
app.Component ? React.createElement(app.Component, { Page }) : React.createElement(Page)
157157
)
158158
)
159159
)

renderer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DataContext, RouterContext } from './context.ts'
44
import { E501App, E501Page, ErrorBoundary } from './error.ts'
55
import type { RouterURL } from './types.ts'
66
import util from './util.ts'
7+
78
export { renderHead } from './head.ts'
89

910
export function renderPage(
@@ -12,8 +13,10 @@ export function renderPage(
1213
App: ComponentType<any> | undefined,
1314
Page: ComponentType<any>,
1415
) {
15-
const pageEl = React.createElement(util.isLikelyReactComponent(Page) ? Page : E501Page)
16-
const appEl = App ? (util.isLikelyReactComponent(App) ? React.createElement(App, null, pageEl) : React.createElement(E501App)) : pageEl
16+
if (!util.isLikelyReactComponent(Page)) {
17+
Page = E501Page
18+
}
19+
const appEl = App ? (util.isLikelyReactComponent(App) ? React.createElement(App, { Page }) : React.createElement(E501App)) : React.createElement(Page)
1720
return renderToString(
1821
React.createElement(
1922
ErrorBoundary,

0 commit comments

Comments
 (0)