Unverified Commit 81b554f3 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Rename todos (#38560)

Renames todos to split them / make it easier to find what has to be done for the new router.


## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm lint`
- [ ] The examples guidelines are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing.md#adding-examples)
parent 62eb16b6
...@@ -510,7 +510,7 @@ export function finalizeEntrypoint({ ...@@ -510,7 +510,7 @@ export function finalizeEntrypoint({
name !== CLIENT_STATIC_FILES_RUNTIME_AMP && name !== CLIENT_STATIC_FILES_RUNTIME_AMP &&
name !== CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH name !== CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH
) { ) {
// TODO: this is a temporary fix. @shuding is going to change the handling of server components // TODO-APP: this is a temporary fix. @shuding is going to change the handling of server components
if (appDir && entry.import.includes('flight')) { if (appDir && entry.import.includes('flight')) {
return { return {
dependOn: CLIENT_STATIC_FILES_RUNTIME_MAIN_ROOT, dependOn: CLIENT_STATIC_FILES_RUNTIME_MAIN_ROOT,
......
import { hydrate, version } from './app-index' import { hydrate, version } from './app-index'
// TODO: implement FOUC guard // TODO-APP: implement FOUC guard
// TODO: hydration warning // TODO-APP: hydration warning
window.next = { window.next = {
version, version,
...@@ -11,4 +11,4 @@ window.next = { ...@@ -11,4 +11,4 @@ window.next = {
hydrate() hydrate()
// TODO: build indicator // TODO-APP: build indicator
...@@ -49,7 +49,7 @@ function ErrorOverlay({ ...@@ -49,7 +49,7 @@ function ErrorOverlay({
} }
} }
// TODO: move this back into AppRouter // TODO-APP: move this back into AppRouter
let initialParallelRoutes: CacheNode['parallelRoutes'] = let initialParallelRoutes: CacheNode['parallelRoutes'] =
typeof window === 'undefined' ? null! : new Map() typeof window === 'undefined' ? null! : new Map()
...@@ -136,7 +136,7 @@ export default function AppRouter({ ...@@ -136,7 +136,7 @@ export default function AppRouter({
} }
const routerInstance: AppRouterInstance = { const routerInstance: AppRouterInstance = {
// TODO: implement prefetching of loading / flight // TODO-APP: implement prefetching of loading / flight
prefetch: (_href) => Promise.resolve(), prefetch: (_href) => Promise.resolve(),
replace: (href) => { replace: (href) => {
// @ts-ignore startTransition exists // @ts-ignore startTransition exists
...@@ -168,7 +168,7 @@ export default function AppRouter({ ...@@ -168,7 +168,7 @@ export default function AppRouter({
dispatch({ dispatch({
type: 'reload', type: 'reload',
payload: { payload: {
// TODO: revisit if this needs to be passed. // TODO-APP: revisit if this needs to be passed.
url: new URL(window.location.href), url: new URL(window.location.href),
cache: { cache: {
data: null, data: null,
...@@ -211,11 +211,11 @@ export default function AppRouter({ ...@@ -211,11 +211,11 @@ export default function AppRouter({
const onPopState = React.useCallback(({ state }: PopStateEvent) => { const onPopState = React.useCallback(({ state }: PopStateEvent) => {
if (!state) { if (!state) {
// TODO: this case only happens when pushState/replaceState was called outside of Next.js. It should probably reload the page in this case. // TODO-APP: this case only happens when pushState/replaceState was called outside of Next.js. It should probably reload the page in this case.
return return
} }
// TODO: this case happens when pushState/replaceState was called outside of Next.js or when the history entry was pushed by the old router. // TODO-APP: this case happens when pushState/replaceState was called outside of Next.js or when the history entry was pushed by the old router.
// It reloads the page in this case but we might have to revisit this as the old router ignores it. // It reloads the page in this case but we might have to revisit this as the old router ignores it.
if (!state.__NA) { if (!state.__NA) {
window.location.reload() window.location.reload()
...@@ -223,7 +223,7 @@ export default function AppRouter({ ...@@ -223,7 +223,7 @@ export default function AppRouter({
} }
// @ts-ignore useTransition exists // @ts-ignore useTransition exists
// TODO: Ideally the back button should not use startTransition as it should apply the updates synchronously // TODO-APP: Ideally the back button should not use startTransition as it should apply the updates synchronously
// Without startTransition works if the cache is there for this path // Without startTransition works if the cache is there for this path
React.startTransition(() => { React.startTransition(() => {
dispatch({ dispatch({
......
...@@ -21,12 +21,12 @@ export function useSearchParam(key: string) { ...@@ -21,12 +21,12 @@ export function useSearchParam(key: string) {
return params[key] return params[key]
} }
// TODO: Move the other router context over to this one // TODO-APP: Move the other router context over to this one
export function useRouter() { export function useRouter() {
return useContext(AppRouterContext) return useContext(AppRouterContext)
} }
// TODO: getting all params when client-side navigating is non-trivial as it does not have route matchers so this might have to be a server context instead. // TODO-APP: getting all params when client-side navigating is non-trivial as it does not have route matchers so this might have to be a server context instead.
// export function useParams() { // export function useParams() {
// return useContext(ParamsContext) // return useContext(ParamsContext)
// } // }
...@@ -35,7 +35,7 @@ export function usePathname() { ...@@ -35,7 +35,7 @@ export function usePathname() {
return useContext(PathnameContext) return useContext(PathnameContext)
} }
// TODO: define what should be provided through context. // TODO-APP: define what should be provided through context.
// export function useLayoutSegments() { // export function useLayoutSegments() {
// return useContext(LayoutSegmentsContext) // return useContext(LayoutSegmentsContext)
// } // }
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
useContext, useContext,
useEffect, useEffect,
useRef, useRef,
// @ts-expect-error TODO: startTransition exists // @ts-expect-error TODO-APP: startTransition exists
startTransition, startTransition,
} from 'react' } from 'react'
import { FullAppTreeContext } from '../../shared/lib/app-router-context' import { FullAppTreeContext } from '../../shared/lib/app-router-context'
...@@ -31,7 +31,7 @@ function getSocketProtocol(assetPrefix: string): string { ...@@ -31,7 +31,7 @@ function getSocketProtocol(assetPrefix: string): string {
// const TIMEOUT = 5000 // const TIMEOUT = 5000
// TODO: add actual type // TODO-APP: add actual type
type PongEvent = any type PongEvent = any
let mostRecentCompilationHash: any = null let mostRecentCompilationHash: any = null
...@@ -305,7 +305,7 @@ function processMessage( ...@@ -305,7 +305,7 @@ function processMessage(
} }
return return
} }
// TODO: make server component change more granular // TODO-APP: make server component change more granular
case 'serverComponentChanges': { case 'serverComponentChanges': {
sendMessage( sendMessage(
JSON.stringify({ JSON.stringify({
...@@ -375,7 +375,7 @@ function processMessage( ...@@ -375,7 +375,7 @@ function processMessage(
// Page exists now, reload // Page exists now, reload
location.reload() location.reload()
} else { } else {
// TODO: fix this // TODO-APP: fix this
// Page doesn't exist // Page doesn't exist
// if ( // if (
// self.__NEXT_DATA__.page === Router.pathname && // self.__NEXT_DATA__.page === Router.pathname &&
...@@ -442,12 +442,12 @@ export default function HotReload({ assetPrefix }: { assetPrefix: string }) { ...@@ -442,12 +442,12 @@ export default function HotReload({ assetPrefix }: { assetPrefix: string }) {
}, [assetPrefix]) }, [assetPrefix])
useEffect(() => { useEffect(() => {
// Taken from on-demand-entries-client.js // Taken from on-demand-entries-client.js
// TODO: check 404 case // TODO-APP: check 404 case
const interval = setInterval(() => { const interval = setInterval(() => {
sendMessage( sendMessage(
JSON.stringify({ JSON.stringify({
event: 'ping', event: 'ping',
// TODO: fix case for dynamic parameters, this will be resolved wrong currently. // TODO-APP: fix case for dynamic parameters, this will be resolved wrong currently.
tree, tree,
appDirRoute: true, appDirRoute: true,
}) })
...@@ -459,7 +459,7 @@ export default function HotReload({ assetPrefix }: { assetPrefix: string }) { ...@@ -459,7 +459,7 @@ export default function HotReload({ assetPrefix }: { assetPrefix: string }) {
const handler = (event: MessageEvent<PongEvent>) => { const handler = (event: MessageEvent<PongEvent>) => {
if ( if (
event.data.indexOf('action') === -1 && event.data.indexOf('action') === -1 &&
// TODO: clean this up for consistency // TODO-APP: clean this up for consistency
event.data.indexOf('pong') === -1 event.data.indexOf('pong') === -1
) { ) {
return return
......
...@@ -123,7 +123,7 @@ export function InnerLayoutRouter({ ...@@ -123,7 +123,7 @@ export function InnerLayoutRouter({
return treeToRecreate return treeToRecreate
} }
// TODO: remove '' // TODO-APP: remove ''
const refetchTree = walkAddRefetch(['', ...segmentPath], fullTree) const refetchTree = walkAddRefetch(['', ...segmentPath], fullTree)
const data = fetchServerResponse(new URL(url, location.origin), refetchTree) const data = fetchServerResponse(new URL(url, location.origin), refetchTree)
...@@ -148,7 +148,7 @@ export function InnerLayoutRouter({ ...@@ -148,7 +148,7 @@ export function InnerLayoutRouter({
} }
if (childNode.data) { if (childNode.data) {
// TODO: error case // TODO-APP: error case
const flightData = childNode.data.readRoot() const flightData = childNode.data.readRoot()
// Handle case when navigating to page in `pages` from `app` // Handle case when navigating to page in `pages` from `app`
...@@ -165,7 +165,7 @@ export function InnerLayoutRouter({ ...@@ -165,7 +165,7 @@ export function InnerLayoutRouter({
if (pathMatches(flightDataPath, segmentPath)) { if (pathMatches(flightDataPath, segmentPath)) {
childNode.data = null childNode.data = null
// Last item is the subtreeData // Last item is the subtreeData
// TODO: routerTreePatch needs to be applied to the tree, handle it in render? // TODO-APP: routerTreePatch needs to be applied to the tree, handle it in render?
const [, /* routerTreePatch */ subTreeData] = flightDataPath.slice(-2) const [, /* routerTreePatch */ subTreeData] = flightDataPath.slice(-2)
childNode.subTreeData = subTreeData childNode.subTreeData = subTreeData
childNode.parallelRoutes = new Map() childNode.parallelRoutes = new Map()
...@@ -182,7 +182,7 @@ export function InnerLayoutRouter({ ...@@ -182,7 +182,7 @@ export function InnerLayoutRouter({
setTimeout(() => { setTimeout(() => {
// @ts-ignore startTransition exists // @ts-ignore startTransition exists
React.startTransition(() => { React.startTransition(() => {
// TODO: handle redirect // TODO-APP: handle redirect
changeByServerResponse(fullTree, flightData) changeByServerResponse(fullTree, flightData)
}) })
}) })
...@@ -191,7 +191,7 @@ export function InnerLayoutRouter({ ...@@ -191,7 +191,7 @@ export function InnerLayoutRouter({
} }
} }
// TODO: double check users can't return null in a component that will kick in here // TODO-APP: double check users can't return null in a component that will kick in here
if (!childNode.subTreeData) { if (!childNode.subTreeData) {
throw createInfinitePromise() throw createInfinitePromise()
} }
...@@ -201,7 +201,7 @@ export function InnerLayoutRouter({ ...@@ -201,7 +201,7 @@ export function InnerLayoutRouter({
value={{ value={{
tree: tree[1][parallelRouterKey], tree: tree[1][parallelRouterKey],
childNodes: childNode.parallelRoutes, childNodes: childNode.parallelRoutes,
// TODO: overriding of url for parallel routes // TODO-APP: overriding of url for parallel routes
url: url, url: url,
}} }}
> >
......
...@@ -12,7 +12,7 @@ const fillCacheWithNewSubTreeData = ( ...@@ -12,7 +12,7 @@ const fillCacheWithNewSubTreeData = (
existingCache: CacheNode, existingCache: CacheNode,
flightDataPath: FlightDataPath flightDataPath: FlightDataPath
) => { ) => {
// TODO: handle case of / (root of the tree) refetch // TODO-APP: handle case of / (root of the tree) refetch
const isLastEntry = flightDataPath.length <= 4 const isLastEntry = flightDataPath.length <= 4
const [parallelRouteKey, segment] = flightDataPath const [parallelRouteKey, segment] = flightDataPath
...@@ -224,7 +224,7 @@ const walkTreeWithFlightDataPath = ( ...@@ -224,7 +224,7 @@ const walkTreeWithFlightDataPath = (
const [currentSegment, parallelRouteKey] = flightSegmentPath const [currentSegment, parallelRouteKey] = flightSegmentPath
// Tree path returned from the server should always match up with the current tree in the browser // Tree path returned from the server should always match up with the current tree in the browser
// TODO: verify // TODO-APP: verify
if (!matchSegment(currentSegment, segment)) { if (!matchSegment(currentSegment, segment)) {
throw new Error('SEGMENT MISMATCH') throw new Error('SEGMENT MISMATCH')
} }
...@@ -315,7 +315,7 @@ export function reducer( ...@@ -315,7 +315,7 @@ export function reducer(
const href = url.pathname + url.search + url.hash const href = url.pathname + url.search + url.hash
const segments = pathname.split('/') const segments = pathname.split('/')
// TODO: figure out something better for index pages // TODO-APP: figure out something better for index pages
segments.push('') segments.push('')
// In case of soft push data fetching happens in layout-router if a segment is missing // In case of soft push data fetching happens in layout-router if a segment is missing
...@@ -352,7 +352,7 @@ export function reducer( ...@@ -352,7 +352,7 @@ export function reducer(
} }
} }
// TODO: flag on the tree of which part of the tree for if there is a loading boundary // TODO-APP: flag on the tree of which part of the tree for if there is a loading boundary
const isOptimistic = false const isOptimistic = false
if (isOptimistic) { if (isOptimistic) {
...@@ -367,7 +367,7 @@ export function reducer( ...@@ -367,7 +367,7 @@ export function reducer(
) )
// Fill in the cache with blank that holds the `data` field. // Fill in the cache with blank that holds the `data` field.
// TODO: segments.slice(1) strips '', we can get rid of '' altogether. // TODO-APP: segments.slice(1) strips '', we can get rid of '' altogether.
const res = fillCacheWithDataProperty( const res = fillCacheWithDataProperty(
cache, cache,
state.cache, state.cache,
...@@ -406,13 +406,13 @@ export function reducer( ...@@ -406,13 +406,13 @@ export function reducer(
cache.data = null cache.data = null
// TODO: ensure flightDataPath does not have "" as first item // TODO-APP: ensure flightDataPath does not have "" as first item
const flightDataPath = flightData[0] const flightDataPath = flightData[0]
const [treePatch] = flightDataPath.slice(-2) const [treePatch] = flightDataPath.slice(-2)
const treePath = flightDataPath.slice(0, -3) const treePath = flightDataPath.slice(0, -3)
const newTree = walkTreeWithFlightDataPath( const newTree = walkTreeWithFlightDataPath(
// TODO: remove '' // TODO-APP: remove ''
['', ...treePath], ['', ...treePath],
state.tree, state.tree,
treePatch treePatch
...@@ -438,7 +438,7 @@ export function reducer( ...@@ -438,7 +438,7 @@ export function reducer(
if (action.type === 'server-patch') { if (action.type === 'server-patch') {
const { flightData, previousTree, cache } = action.payload const { flightData, previousTree, cache } = action.payload
if (JSON.stringify(previousTree) !== JSON.stringify(state.tree)) { if (JSON.stringify(previousTree) !== JSON.stringify(state.tree)) {
// TODO: Handle tree mismatch // TODO-APP: Handle tree mismatch
console.log('TREE MISMATCH') console.log('TREE MISMATCH')
return { return {
canonicalUrl: state.canonicalUrl, canonicalUrl: state.canonicalUrl,
...@@ -458,7 +458,7 @@ export function reducer( ...@@ -458,7 +458,7 @@ export function reducer(
} }
} }
// TODO: flightData could hold multiple paths // TODO-APP: flightData could hold multiple paths
const flightDataPath = flightData[0] const flightDataPath = flightData[0]
// Slices off the last segment (which is at -3) as it doesn't exist in the tree yet // Slices off the last segment (which is at -3) as it doesn't exist in the tree yet
...@@ -466,7 +466,7 @@ export function reducer( ...@@ -466,7 +466,7 @@ export function reducer(
const [treePatch] = flightDataPath.slice(-2) const [treePatch] = flightDataPath.slice(-2)
const newTree = walkTreeWithFlightDataPath( const newTree = walkTreeWithFlightDataPath(
// TODO: remove '' // TODO-APP: remove ''
['', ...treePath], ['', ...treePath],
state.tree, state.tree,
treePatch treePatch
...@@ -526,18 +526,18 @@ export function reducer( ...@@ -526,18 +526,18 @@ export function reducer(
cache.data = null cache.data = null
// TODO: ensure flightDataPath does not have "" as first item // TODO-APP: ensure flightDataPath does not have "" as first item
const flightDataPath = flightData[0] const flightDataPath = flightData[0]
if (flightDataPath.length !== 2) { if (flightDataPath.length !== 2) {
// TODO: handle this case better // TODO-APP: handle this case better
console.log('RELOAD FAILED') console.log('RELOAD FAILED')
return state return state
} }
const [treePatch, subTreeData] = flightDataPath.slice(-2) const [treePatch, subTreeData] = flightDataPath.slice(-2)
const newTree = walkTreeWithFlightDataPath( const newTree = walkTreeWithFlightDataPath(
// TODO: remove '' // TODO-APP: remove ''
[''], [''],
state.tree, state.tree,
treePatch treePatch
......
...@@ -46,7 +46,7 @@ type InternalLinkProps = { ...@@ -46,7 +46,7 @@ type InternalLinkProps = {
onClick?: (e: any) => void onClick?: (e: any) => void
} }
// TODO: Include the full set of Anchor props // TODO-APP: Include the full set of Anchor props
// adding this to the publicly exported type currently breaks existing apps // adding this to the publicly exported type currently breaks existing apps
export type LinkProps = InternalLinkProps export type LinkProps = InternalLinkProps
type LinkPropsRequired = RequiredKeys<LinkProps> type LinkPropsRequired = RequiredKeys<LinkProps>
...@@ -292,7 +292,7 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>( ...@@ -292,7 +292,7 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(
: [] : []
let router = React.useContext(RouterContext) let router = React.useContext(RouterContext)
// TODO: type error. Remove `as any` // TODO-APP: type error. Remove `as any`
const appRouter = React.useContext(AppRouterContext) as any const appRouter = React.useContext(AppRouterContext) as any
if (appRouter) { if (appRouter) {
router = appRouter router = appRouter
......
import React from 'react'
export type LayoutProps = {
children: any
}
export default function AppLayout({ children }: LayoutProps) {
return (
<html>
<head>
{/* TODO: Remove <title> */}
<title>Test</title>
</head>
<body>{children}</body>
</html>
)
}
...@@ -385,9 +385,9 @@ export async function renderToHTML( ...@@ -385,9 +385,9 @@ export async function renderToHTML(
) )
} }
// TODO: verify the tree is valid // TODO-APP: verify the tree is valid
// TODO: verify query param is single value (not an array) // TODO-APP: verify query param is single value (not an array)
// TODO: verify tree can't grow out of control // TODO-APP: verify tree can't grow out of control
const providedFlightRouterState: FlightRouterState = isFlight const providedFlightRouterState: FlightRouterState = isFlight
? query.__flight_router_state_tree__ ? query.__flight_router_state_tree__
? JSON.parse(query.__flight_router_state_tree__ as string) ? JSON.parse(query.__flight_router_state_tree__ as string)
...@@ -406,7 +406,7 @@ export async function renderToHTML( ...@@ -406,7 +406,7 @@ export async function renderToHTML(
| null | null
const headers = req.headers const headers = req.headers
// @ts-expect-error TODO: fix type of req // @ts-expect-error TODO-APP: fix type of req
const cookies = req.cookies const cookies = req.cookies
const tree: LoaderTree = ComponentMod.tree const tree: LoaderTree = ComponentMod.tree
...@@ -421,7 +421,7 @@ export async function renderToHTML( ...@@ -421,7 +421,7 @@ export async function renderToHTML(
) )
const isPreview = previewData !== false const isPreview = previewData !== false
const serverContexts: Array<[string, any]> = [ const serverContexts: Array<[string, any]> = [
['WORKAROUND', null], // TODO: First value has a bug currently where the value is not set on the second request ['WORKAROUND', null], // TODO-APP: First value has a bug currently where the value is not set on the second request
['HeadersContext', headers], ['HeadersContext', headers],
['CookiesContext', cookies], ['CookiesContext', cookies],
['PreviewDataContext', previewData], ['PreviewDataContext', previewData],
...@@ -442,7 +442,7 @@ export async function renderToHTML( ...@@ -442,7 +442,7 @@ export async function renderToHTML(
treeValue: string treeValue: string
type: DynamicParamTypesShort type: DynamicParamTypesShort
} | null => { } | null => {
// TODO: use correct matching for dynamic routes to get segment param // TODO-APP: use correct matching for dynamic routes to get segment param
const segmentParam = getSegmentParam(segment) const segmentParam = getSegmentParam(segment)
if (!segmentParam) { if (!segmentParam) {
return null return null
...@@ -517,7 +517,7 @@ export async function renderToHTML( ...@@ -517,7 +517,7 @@ export async function renderToHTML(
layoutOrPageMod && !layoutOrPageMod.hasOwnProperty('__next_rsc__') layoutOrPageMod && !layoutOrPageMod.hasOwnProperty('__next_rsc__')
// Only server components can have getServerSideProps / getStaticProps // Only server components can have getServerSideProps / getStaticProps
// TODO: friendly error with correct stacktrace. Potentially this can be part of the compiler instead. // TODO-APP: friendly error with correct stacktrace. Potentially this can be part of the compiler instead.
if (isClientComponentModule) { if (isClientComponentModule) {
if (layoutOrPageMod.getServerSideProps) { if (layoutOrPageMod.getServerSideProps) {
throw new Error( throw new Error(
...@@ -602,7 +602,7 @@ export async function renderToHTML( ...@@ -602,7 +602,7 @@ export async function renderToHTML(
let fetcher: (() => Promise<any>) | null = null let fetcher: (() => Promise<any>) | null = null
type GetServerSidePropsContext = { type GetServerSidePropsContext = {
// TODO: has to be serializable // TODO-APP: has to be serializable
headers: IncomingHttpHeaders headers: IncomingHttpHeaders
cookies: NextApiRequestCookies cookies: NextApiRequestCookies
layoutSegments: FlightSegmentPath layoutSegments: FlightSegmentPath
...@@ -616,9 +616,9 @@ export async function renderToHTML( ...@@ -616,9 +616,9 @@ export async function renderToHTML(
pathname: string pathname: string
} }
// TODO: pass a shared cache from previous getStaticProps/getServerSideProps calls? // TODO-APP: pass a shared cache from previous getStaticProps/getServerSideProps calls?
if (layoutOrPageMod.getServerSideProps) { if (layoutOrPageMod.getServerSideProps) {
// TODO: recommendation for i18n // TODO-APP: recommendation for i18n
// locales: (renderOpts as any).locales, // always the same // locales: (renderOpts as any).locales, // always the same
// locale: (renderOpts as any).locale, // /nl/something -> nl // locale: (renderOpts as any).locale, // /nl/something -> nl
// defaultLocale: (renderOpts as any).defaultLocale, // changes based on domain // defaultLocale: (renderOpts as any).defaultLocale, // changes based on domain
...@@ -628,7 +628,7 @@ export async function renderToHTML( ...@@ -628,7 +628,7 @@ export async function renderToHTML(
headers, headers,
cookies, cookies,
layoutSegments: segmentPath, layoutSegments: segmentPath,
// TODO: Currently query holds params and pathname is not the actual pathname, it holds the dynamic parameter // TODO-APP: Currently query holds params and pathname is not the actual pathname, it holds the dynamic parameter
...(isPage ? { query, pathname } : {}), ...(isPage ? { query, pathname } : {}),
...(pageIsDynamic ? { params: currentParams } : undefined), ...(pageIsDynamic ? { params: currentParams } : undefined),
...(isPreview ...(isPreview
...@@ -640,11 +640,11 @@ export async function renderToHTML( ...@@ -640,11 +640,11 @@ export async function renderToHTML(
layoutOrPageMod.getServerSideProps(getServerSidePropsContext) layoutOrPageMod.getServerSideProps(getServerSidePropsContext)
) )
} }
// TODO: implement layout specific caching for getStaticProps // TODO-APP: implement layout specific caching for getStaticProps
if (layoutOrPageMod.getStaticProps) { if (layoutOrPageMod.getStaticProps) {
const getStaticPropsContext = { const getStaticPropsContext = {
layoutSegments: segmentPath, layoutSegments: segmentPath,
// TODO: change this to be URLSearchParams instead? // TODO-APP: change this to be URLSearchParams instead?
...(isPage ? { pathname } : {}), ...(isPage ? { pathname } : {}),
...(pageIsDynamic ? { params: currentParams } : undefined), ...(pageIsDynamic ? { params: currentParams } : undefined),
...(isPreview ...(isPreview
...@@ -686,7 +686,7 @@ export async function renderToHTML( ...@@ -686,7 +686,7 @@ export async function renderToHTML(
<Component <Component
{...props} {...props}
{...parallelRouteComponents} {...parallelRouteComponents}
// TODO: params and query have to be blocked parallel route names. Might have to add a reserved name list. // TODO-APP: params and query have to be blocked parallel route names. Might have to add a reserved name list.
// Params are always the current params that apply to the layout // Params are always the current params that apply to the layout
// If you have a `/dashboard/[team]/layout.js` it will provide `team` as a param but not anything further down. // If you have a `/dashboard/[team]/layout.js` it will provide `team` as a param but not anything further down.
params={currentParams} params={currentParams}
...@@ -699,7 +699,7 @@ export async function renderToHTML( ...@@ -699,7 +699,7 @@ export async function renderToHTML(
} }
if (isFlight) { if (isFlight) {
// TODO: throw on invalid flightRouterState // TODO-APP: throw on invalid flightRouterState
const walkTreeWithFlightRouterState = ( const walkTreeWithFlightRouterState = (
treeToFilter: LoaderTree, treeToFilter: LoaderTree,
parentParams: { [key: string]: string | string[] }, parentParams: { [key: string]: string | string[] },
...@@ -770,7 +770,7 @@ export async function renderToHTML( ...@@ -770,7 +770,7 @@ export async function renderToHTML(
serverComponentManifest serverComponentManifest
) )
const flightData: FlightData = [ const flightData: FlightData = [
// TODO: change walk to output without '' // TODO-APP: change walk to output without ''
walkTreeWithFlightRouterState(tree, {}, providedFlightRouterState).slice( walkTreeWithFlightRouterState(tree, {}, providedFlightRouterState).slice(
1 1
), ),
...@@ -785,10 +785,10 @@ export async function renderToHTML( ...@@ -785,10 +785,10 @@ export async function renderToHTML(
const search = stringifyQuery(query) const search = stringifyQuery(query)
// TODO: validate req.url as it gets passed to render. // TODO-APP: validate req.url as it gets passed to render.
const initialCanonicalUrl = req.url! const initialCanonicalUrl = req.url!
// TODO: change tree to accommodate this // TODO-APP: change tree to accommodate this
// /blog/[...slug]/page.js -> /blog/hello-world/b/c/d -> ['children', 'blog', 'children', ['slug', 'hello-world/b/c/d']] // /blog/[...slug]/page.js -> /blog/hello-world/b/c/d -> ['children', 'blog', 'children', ['slug', 'hello-world/b/c/d']]
// /blog/[slug] /blog/hello-world -> ['children', 'blog', 'children', ['slug', 'hello-world']] // /blog/[slug] /blog/hello-world -> ['children', 'blog', 'children', ['slug', 'hello-world']]
const initialTree = createFlightRouterStateFromLoaderTree(tree) const initialTree = createFlightRouterStateFromLoaderTree(tree)
......
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