diff --git a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts index 622d837a01b047b..57e2ff6ee13a3dd 100644 --- a/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts +++ b/packages/next/build/webpack/plugins/flight-client-entry-plugin.ts @@ -561,7 +561,6 @@ export class FlightClientEntryPlugin { return shouldInvalidate } - // TODO-APP: make sure dependsOn is added for layouts/pages addEntry( compilation: any, context: string, diff --git a/packages/next/client/components/app-router.tsx b/packages/next/client/components/app-router.tsx index 15b1420fa5c94ec..29f6ba8501a7e04 100644 --- a/packages/next/client/components/app-router.tsx +++ b/packages/next/client/components/app-router.tsx @@ -95,7 +95,6 @@ export async function fetchServerResponse( } // Ensure the initialParallelRoutes are not combined because of double-rendering in the browser with Strict Mode. -// TODO-APP: move this back into AppRouter let initialParallelRoutes: CacheNode['parallelRoutes'] = typeof window === 'undefined' ? null! : new Map() @@ -254,7 +253,6 @@ function Router({ const routerInstance: AppRouterInstance = { back: () => window.history.back(), forward: () => window.history.forward(), - // TODO-APP: implement prefetching of flight prefetch: async (href) => { // If prefetch has already been triggered, don't trigger it again. if (prefetched.has(href)) { @@ -264,7 +262,6 @@ function Router({ const url = new URL(href, location.origin) try { const routerTree = window.history.state?.tree || initialTree - // TODO-APP: handle case where history.state is not the new router history entry const serverResponse = await fetchServerResponse( url, // initialTree is used when history.state.tree is missing because the history state is set in `useEffect` below, it being missing means this is the hydration case. @@ -301,8 +298,6 @@ function Router({ React.startTransition(() => { dispatch({ type: ACTION_REFRESH, - - // TODO-APP: revisit if this needs to be passed. cache: { status: CacheStates.LAZY_INITIALIZED, data: null, @@ -363,8 +358,7 @@ function Router({ return } - // 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. + // This case happens when when the history entry was pushed by the `pages` router. if (!state.__NA) { window.location.reload() return diff --git a/packages/next/client/components/layout-router.tsx b/packages/next/client/components/layout-router.tsx index 36bcaaf3259278c..35898fd9dfda6de 100644 --- a/packages/next/client/components/layout-router.tsx +++ b/packages/next/client/components/layout-router.tsx @@ -209,7 +209,6 @@ export function InnerLayoutRouter({ // If cache node has a data request we have to unwrap response by `use` and update the cache. if (childNode.data) { - // TODO-APP: error case /** * Flight response data */ @@ -229,7 +228,6 @@ export function InnerLayoutRouter({ setTimeout(() => { // @ts-ignore startTransition exists React.startTransition(() => { - // TODO-APP: handle redirect changeByServerResponse(fullTree, flightData, overrideCanonicalUrl) }) }) diff --git a/packages/next/client/components/navigation.ts b/packages/next/client/components/navigation.ts index 99bc8f4c8d463d1..2c8990a9e64a849 100644 --- a/packages/next/client/components/navigation.ts +++ b/packages/next/client/components/navigation.ts @@ -109,7 +109,6 @@ export { useServerInsertedHTML, } from '../../shared/lib/server-inserted-html' -// TODO-APP: Move the other router context over to this one /** * Get the router methods. For example router.push('/dashboard') */ diff --git a/packages/next/client/components/react-dev-overlay/internal/helpers/launchEditor.ts b/packages/next/client/components/react-dev-overlay/internal/helpers/launchEditor.ts index 350163fe646fef8..6828faf6eb0a20c 100644 --- a/packages/next/client/components/react-dev-overlay/internal/helpers/launchEditor.ts +++ b/packages/next/client/components/react-dev-overlay/internal/helpers/launchEditor.ts @@ -214,7 +214,6 @@ function getArgumentsForLineNumber( function guessEditor(): string[] { // Explicit config always wins if (process.env.REACT_EDITOR) { - // TODO-APP: fix this type return shellQuote.parse(process.env.REACT_EDITOR) as any } diff --git a/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts b/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts index 91405df55e1b608..615e7cddbda08d4 100644 --- a/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts +++ b/packages/next/client/components/react-dev-overlay/internal/helpers/use-websocket.ts @@ -55,7 +55,6 @@ export function useWebsocketPing( sendMessage( JSON.stringify({ event: 'ping', - // TODO-APP: fix case for dynamic parameters, this will be resolved wrong currently. tree, appDirRoute: true, }) diff --git a/packages/next/client/components/reducer.ts b/packages/next/client/components/reducer.ts index 1a3760124e47d8f..93898186419ee9b 100644 --- a/packages/next/client/components/reducer.ts +++ b/packages/next/client/components/reducer.ts @@ -54,7 +54,6 @@ export function createHrefFromUrl( /** * Invalidate cache one level down from the router state. */ -// TODO-APP: Verify if this needs to be recursive. function invalidateCacheByRouterState( newCache: CacheNode, existingCache: CacheNode, @@ -472,12 +471,6 @@ function createOptimisticTree( result[3] = 'refetch' } - // TODO-APP: Revisit - // Add url into the tree - // if (isFirstSegment) { - // result[2] = href - // } - return result } @@ -495,10 +488,6 @@ function applyRouterStatePatchToTree( if (flightSegmentPath.length === 1) { const tree: FlightRouterState = [...treePatch] - // TODO-APP: revisit - // if (url) { - // tree[2] = url - // } return tree } @@ -539,11 +528,6 @@ function applyRouterStatePatchToTree( tree[4] = true } - // TODO-APP: Revisit - // if (url) { - // tree[2] = url - // } - return tree } @@ -812,7 +796,6 @@ function clientReducer( canonicalUrl: mutable.canonicalUrlOverride ? mutable.canonicalUrlOverride : href, - // TODO-APP: verify mpaNavigation not being set is correct here. pushRef: { pendingPush, mpaNavigation: mutable.mpaNavigation, @@ -834,7 +817,6 @@ function clientReducer( canonicalUrl: mutable.canonicalUrlOverride ? mutable.canonicalUrlOverride : href, - // TODO-APP: verify mpaNavigation not being set is correct here. pushRef: { pendingPush, mpaNavigation: false, @@ -877,7 +859,6 @@ function clientReducer( ) if (hardNavigate) { - // TODO-APP: segments.slice(1) strips '', we can get rid of '' altogether. // Copy subTreeData for the root node of the cache. cache.subTreeData = state.cache.subTreeData @@ -1333,7 +1314,6 @@ function clientReducer( const { url, serverResponse } = action const [flightData, canonicalUrlOverride] = serverResponse - // TODO-APP: Implement prefetch for hard navigation if (typeof flightData === 'string') { return state } diff --git a/packages/next/server/app-render.tsx b/packages/next/server/app-render.tsx index d1f41e47d05fed5..a625740694b3292 100644 --- a/packages/next/server/app-render.tsx +++ b/packages/next/server/app-render.tsx @@ -1586,7 +1586,6 @@ export async function renderToHTMLOrFlight( // Flight data that is going to be passed to the browser. // Currently a single item array but in the future multiple patches might be combined in a single request. const flightData: FlightData = [ - // TODO-APP: change walk to output without '' ( await walkTreeWithFlightRouterState({ createSegmentPath: (child) => child, @@ -1792,7 +1791,6 @@ export async function renderToHTMLOrFlight( res.statusCode = 404 } - // TODO-APP: show error overlay in development. `element` should probably be wrapped in AppRouter for this case. const renderStream = await renderToInitialStream({ ReactDOMServer, element: ( diff --git a/packages/next/types/index.d.ts b/packages/next/types/index.d.ts index c2550b9bf3e8d39..f1186464bb04d9d 100644 --- a/packages/next/types/index.d.ts +++ b/packages/next/types/index.d.ts @@ -40,7 +40,6 @@ declare module 'react' { nonce?: string } - // TODO-APP: check if this is the right type. function use(promise: Promise | React.Context): T function cache(fn: T): T }