Unverified Commit b507e75e authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove implemented todos (#38610)

Went through the todos I had added while implementing the new router and removes everything that is now covered.


## 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 7cb92a6e
...@@ -12,7 +12,6 @@ const fillCacheWithNewSubTreeData = ( ...@@ -12,7 +12,6 @@ const fillCacheWithNewSubTreeData = (
existingCache: CacheNode, existingCache: CacheNode,
flightDataPath: FlightDataPath flightDataPath: FlightDataPath
) => { ) => {
// 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
...@@ -267,7 +266,6 @@ const walkTreeWithFlightDataPath = ( ...@@ -267,7 +266,6 @@ 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-APP: verify
if (!matchSegment(currentSegment, segment)) { if (!matchSegment(currentSegment, segment)) {
throw new Error('SEGMENT MISMATCH') throw new Error('SEGMENT MISMATCH')
} }
...@@ -575,7 +573,6 @@ export function reducer( ...@@ -575,7 +573,6 @@ export function reducer(
cache.data = null cache.data = null
// 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) {
......
...@@ -456,7 +456,7 @@ export async function renderToHTML( ...@@ -456,7 +456,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-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], ['HeadersContext', headers],
['CookiesContext', cookies], ['CookiesContext', cookies],
['PreviewDataContext', previewData], ['PreviewDataContext', previewData],
...@@ -477,7 +477,6 @@ export async function renderToHTML( ...@@ -477,7 +477,6 @@ export async function renderToHTML(
treeValue: string treeValue: string
type: DynamicParamTypesShort type: DynamicParamTypesShort
} | null => { } | null => {
// 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
...@@ -643,7 +642,6 @@ export async function renderToHTML( ...@@ -643,7 +642,6 @@ export async function renderToHTML(
let fetcher: (() => Promise<any>) | null = null let fetcher: (() => Promise<any>) | null = null
type GetServerSidePropsContext = { type GetServerSidePropsContext = {
// TODO-APP: has to be serializable
headers: IncomingHttpHeaders headers: IncomingHttpHeaders
cookies: NextApiRequestCookies cookies: NextApiRequestCookies
layoutSegments: FlightSegmentPath layoutSegments: FlightSegmentPath
...@@ -669,7 +667,7 @@ export async function renderToHTML( ...@@ -669,7 +667,7 @@ export async function renderToHTML(
headers, headers,
cookies, cookies,
layoutSegments: segmentPath, 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 } : {}), ...(isPage ? { query, pathname } : {}),
...(pageIsDynamic ? { params: currentParams } : undefined), ...(pageIsDynamic ? { params: currentParams } : undefined),
...(isPreview ...(isPreview
...@@ -685,7 +683,6 @@ export async function renderToHTML( ...@@ -685,7 +683,6 @@ export async function renderToHTML(
if (layoutOrPageMod.getStaticProps) { if (layoutOrPageMod.getStaticProps) {
const getStaticPropsContext = { const getStaticPropsContext = {
layoutSegments: segmentPath, layoutSegments: segmentPath,
// TODO-APP: change this to be URLSearchParams instead?
...(isPage ? { pathname } : {}), ...(isPage ? { pathname } : {}),
...(pageIsDynamic ? { params: currentParams } : undefined), ...(pageIsDynamic ? { params: currentParams } : undefined),
...(isPreview ...(isPreview
...@@ -832,9 +829,6 @@ export async function renderToHTML( ...@@ -832,9 +829,6 @@ export async function renderToHTML(
// TODO-APP: 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-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 initialTree = createFlightRouterStateFromLoaderTree(tree)
const initialStylesheets: string[] = getCSSInlinedLinkTags( const initialStylesheets: string[] = getCSSInlinedLinkTags(
......
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