Skip to content

Commit d72c459

Browse files
committed
Revert "Merge pull request #2289 from skryukov/allow-better-empty-root-handling"
This reverts commit ca462f6, reversing changes made to 8840dc0.
1 parent 67c813c commit d72c459

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/react/src/createInertiaApp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type InertiaAppOptionsForCSR<SharedProps extends PageProps> = BaseInertiaAppOpti
4545
includeCSS?: boolean
4646
showSpinner?: boolean
4747
}
48-
setup(options: SetupOptions<HTMLElement | null, SharedProps>): CreateInertiaAppSetupReturnType
48+
setup(options: SetupOptions<HTMLElement, SharedProps>): CreateInertiaAppSetupReturnType
4949
}
5050

5151
type CreateInertiaAppSSRContent = { head: string[]; body: string }
@@ -76,7 +76,7 @@ export default async function createInertiaApp<SharedProps extends PageProps = P
7676
> {
7777
const isServer = typeof window === 'undefined'
7878
const el = isServer ? null : document.getElementById(id)
79-
const initialPage = page || JSON.parse(el?.dataset.page || '{}')
79+
const initialPage = page || JSON.parse(el.dataset.page)
8080
// @ts-expect-error
8181
const resolveComponent = (name) => Promise.resolve(resolve(name)).then((module) => module.default || module)
8282

packages/vue3/src/createInertiaApp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import App, { InertiaApp, InertiaAppProps, plugin } from './app'
55
interface CreateInertiaAppProps {
66
id?: string
77
resolve: (name: string) => DefineComponent | Promise<DefineComponent> | { default: DefineComponent }
8-
setup: (props: { el: HTMLElement | null; App: InertiaApp; props: InertiaAppProps; plugin: Plugin }) => void | VueApp
8+
setup: (props: { el: Element; App: InertiaApp; props: InertiaAppProps; plugin: Plugin }) => void | VueApp
99
title?: (title: string) => string
1010
progress?:
1111
| false
@@ -30,7 +30,7 @@ export default async function createInertiaApp({
3030
}: CreateInertiaAppProps): Promise<{ head: string[]; body: string }> {
3131
const isServer = typeof window === 'undefined'
3232
const el = isServer ? null : document.getElementById(id)
33-
const initialPage = page || JSON.parse(el?.dataset.page || '{}')
33+
const initialPage = page || JSON.parse(el.dataset.page)
3434
const resolveComponent = (name) => Promise.resolve(resolve(name)).then((module) => module.default || module)
3535

3636
let head = []

0 commit comments

Comments
 (0)