From 0ea9ed9a37648a5874e74dc1d9fa532dc2603414 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Wed, 13 Jul 2022 17:48:59 +0200 Subject: [PATCH] Remove implemented todos --- packages/next/client/components/reducer.ts | 3 --- packages/next/server/app-render.tsx | 10 ++-------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/next/client/components/reducer.ts b/packages/next/client/components/reducer.ts index f7afa1e4e8fa..e1293645e085 100644 --- a/packages/next/client/components/reducer.ts +++ b/packages/next/client/components/reducer.ts @@ -12,7 +12,6 @@ const fillCacheWithNewSubTreeData = ( existingCache: CacheNode, flightDataPath: FlightDataPath ) => { - // TODO-APP: handle case of / (root of the tree) refetch const isLastEntry = flightDataPath.length <= 4 const [parallelRouteKey, segment] = flightDataPath @@ -224,7 +223,6 @@ const walkTreeWithFlightDataPath = ( const [currentSegment, parallelRouteKey] = flightSegmentPath // Tree path returned from the server should always match up with the current tree in the browser - // TODO-APP: verify if (!matchSegment(currentSegment, segment)) { throw new Error('SEGMENT MISMATCH') } @@ -526,7 +524,6 @@ export function reducer( cache.data = null - // TODO-APP: ensure flightDataPath does not have "" as first item const flightDataPath = flightData[0] if (flightDataPath.length !== 2) { diff --git a/packages/next/server/app-render.tsx b/packages/next/server/app-render.tsx index 99acf92e0387..b246c8217f55 100644 --- a/packages/next/server/app-render.tsx +++ b/packages/next/server/app-render.tsx @@ -455,7 +455,7 @@ export async function renderToHTML( ) const isPreview = previewData !== false const serverContexts: Array<[string, any]> = [ - ['WORKAROUND', null], // TODO-APP: 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: https://github.com/facebook/react/issues/24849 ['HeadersContext', headers], ['CookiesContext', cookies], ['PreviewDataContext', previewData], @@ -476,7 +476,6 @@ export async function renderToHTML( treeValue: string type: DynamicParamTypesShort } | null => { - // TODO-APP: use correct matching for dynamic routes to get segment param const segmentParam = getSegmentParam(segment) if (!segmentParam) { return null @@ -636,7 +635,6 @@ export async function renderToHTML( let fetcher: (() => Promise) | null = null type GetServerSidePropsContext = { - // TODO-APP: has to be serializable headers: IncomingHttpHeaders cookies: NextApiRequestCookies layoutSegments: FlightSegmentPath @@ -662,7 +660,7 @@ export async function renderToHTML( headers, cookies, layoutSegments: segmentPath, - // TODO-APP: Currently query holds params and pathname is not the actual pathname, it holds the dynamic parameter + // TODO-APP: change pathname to actual pathname, it holds the dynamic parameter currently ...(isPage ? { query, pathname } : {}), ...(pageIsDynamic ? { params: currentParams } : undefined), ...(isPreview @@ -678,7 +676,6 @@ export async function renderToHTML( if (layoutOrPageMod.getStaticProps) { const getStaticPropsContext = { layoutSegments: segmentPath, - // TODO-APP: change this to be URLSearchParams instead? ...(isPage ? { pathname } : {}), ...(pageIsDynamic ? { params: currentParams } : undefined), ...(isPreview @@ -825,9 +822,6 @@ export async function renderToHTML( // TODO-APP: validate req.url as it gets passed to render. const initialCanonicalUrl = req.url! - // 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] /blog/hello-world -> ['children', 'blog', 'children', ['slug', 'hello-world']] const initialTree = createFlightRouterStateFromLoaderTree(tree) const initialStylesheets: string[] = getCSSInlinedLinkTags(