Commit 80b46c1d authored by JJ Kasper's avatar JJ Kasper Committed by Joe Haddad

Update to have default pageProps of {} instead of null (#7734)

* Update to have default pageProps of {} instead of null

* Update test

* Test for empty object
parent 7f3bdb1b
...@@ -228,7 +228,7 @@ export async function loadGetInitialProps< ...@@ -228,7 +228,7 @@ export async function loadGetInitialProps<
const res = ctx.res || (ctx.ctx && ctx.ctx.res) const res = ctx.res || (ctx.ctx && ctx.ctx.res)
if (!Component.getInitialProps) { if (!Component.getInitialProps) {
return null return {} as any
} }
const props = await Component.getInitialProps(ctx) const props = await Component.getInitialProps(ctx)
......
...@@ -13,9 +13,9 @@ describe('loadGetInitialProps', () => { ...@@ -13,9 +13,9 @@ describe('loadGetInitialProps', () => {
return expect(rejectPromise).rejects.toEqual(error) return expect(rejectPromise).rejects.toEqual(error)
}) })
it('should resolve to null if getInitialProps is missing', async () => { it('should resolve to an empty object if getInitialProps is missing', async () => {
const result = await loadGetInitialProps(() => {}, {}) const result = await loadGetInitialProps(() => {}, {})
expect(result).toEqual(null) expect(result).toEqual({})
}) })
it('should resolve getInitialProps', async () => { it('should resolve getInitialProps', async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment