未验证 提交 cb786ebd 编写于 作者: J Joe Haddad 提交者: GitHub

Share NEXT_DATA type instead of recreating it (#16174)

上级 33176806
/* global location */ /* global location */
import type { ParsedUrlQuery } from 'querystring'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import { HeadManagerContext } from '../next-server/lib/head-manager-context' import { HeadManagerContext } from '../next-server/lib/head-manager-context'
...@@ -16,6 +15,7 @@ import { isDynamicRoute } from '../next-server/lib/router/utils/is-dynamic' ...@@ -16,6 +15,7 @@ import { isDynamicRoute } from '../next-server/lib/router/utils/is-dynamic'
import * as querystring from '../next-server/lib/router/utils/querystring' import * as querystring from '../next-server/lib/router/utils/querystring'
import * as envConfig from '../next-server/lib/runtime-config' import * as envConfig from '../next-server/lib/runtime-config'
import { getURL, loadGetInitialProps, ST } from '../next-server/lib/utils' import { getURL, loadGetInitialProps, ST } from '../next-server/lib/utils'
import type { NEXT_DATA } from '../next-server/lib/utils'
import initHeadManager from './head-manager' import initHeadManager from './head-manager'
import PageLoader from './page-loader' import PageLoader from './page-loader'
import measureWebVitals from './performance-relayer' import measureWebVitals from './performance-relayer'
...@@ -33,20 +33,7 @@ declare global { ...@@ -33,20 +33,7 @@ declare global {
/* prod */ /* prod */
__NEXT_PRELOADREADY?: (ids?: string[]) => void __NEXT_PRELOADREADY?: (ids?: string[]) => void
__NEXT_DATA__: NEXT_DATA
__NEXT_DATA__: {
props: Record<string, any>
err?: Error
page: string
query: ParsedUrlQuery
buildId: string
assetPrefix?: string
runtimeConfig?: object
dynamicIds?: string[]
isFallback?: boolean
nextExport?: boolean
}
__NEXT_P: any[] __NEXT_P: any[]
} }
} }
......
...@@ -82,7 +82,7 @@ export type BaseContext = { ...@@ -82,7 +82,7 @@ export type BaseContext = {
} }
export type NEXT_DATA = { export type NEXT_DATA = {
props: any props: Record<string, any>
page: string page: string
query: ParsedUrlQuery query: ParsedUrlQuery
buildId: string buildId: string
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册