From 4c3b7f9b7a7b6044059c73c5da34b9111e35fe2d Mon Sep 17 00:00:00 2001 From: Max Leiter Date: Tue, 29 Aug 2023 14:05:44 -0400 Subject: [PATCH 01/24] Export RedirectType from next/navigation (#54729) A continuation of #51864 with RedirectType used in an e2e test and some ts-ignores removed from the codebase. Happy to split it into two PRs but I left comments in the two consequential files --------- --- packages/next/src/client/components/navigation.ts | 2 +- packages/next/src/client/components/redirect-boundary.tsx | 1 - packages/third-parties/scripts/update-third-parties.js | 3 --- packages/third-parties/src/google/index.tsx | 1 - .../fixtures/app-hmr-changes/app/(post)/components/tweet.tsx | 1 - test/e2e/app-dir/app-prefetch/prefetching.test.ts | 1 - .../e2e/app-dir/metadata-dynamic-routes/app/twitter-image.tsx | 1 - test/e2e/app-dir/metadata/app/basic-edge/client.tsx | 1 - test/e2e/app-dir/metadata/app/basic/client.tsx | 1 - test/e2e/app-dir/navigation/app/assertion/page/page.js | 1 - test/e2e/app-dir/navigation/app/assertion/route/route.js | 1 - .../app-dir/navigation/app/redirect/servercomponent-2/page.js | 4 ++-- test/e2e/app-dir/navigation/middleware.js | 1 - test/unit/next-babel-loader-dev.test.ts | 1 - test/unit/next-babel-loader-prod.test.ts | 1 - 15 files changed, 3 insertions(+), 18 deletions(-) diff --git a/packages/next/src/client/components/navigation.ts b/packages/next/src/client/components/navigation.ts index 4c28fa60d058c..bf6a56100080d 100644 --- a/packages/next/src/client/components/navigation.ts +++ b/packages/next/src/client/components/navigation.ts @@ -238,5 +238,5 @@ export function useSelectedLayoutSegment( return selectedLayoutSegments[0] } -export { redirect, permanentRedirect } from './redirect' +export { redirect, permanentRedirect, RedirectType } from './redirect' export { notFound } from './not-found' diff --git a/packages/next/src/client/components/redirect-boundary.tsx b/packages/next/src/client/components/redirect-boundary.tsx index 6d0cbbba70401..23e5493ae83fb 100644 --- a/packages/next/src/client/components/redirect-boundary.tsx +++ b/packages/next/src/client/components/redirect-boundary.tsx @@ -26,7 +26,6 @@ function HandleRedirect({ const router = useRouter() useEffect(() => { - // @ts-ignore startTransition exists React.startTransition(() => { if (redirectType === RedirectType.push) { router.push(redirect, {}) diff --git a/packages/third-parties/scripts/update-third-parties.js b/packages/third-parties/scripts/update-third-parties.js index 5f7ed1b30e571..eb690033687a7 100644 --- a/packages/third-parties/scripts/update-third-parties.js +++ b/packages/third-parties/scripts/update-third-parties.js @@ -23,10 +23,7 @@ function generateComponent(thirdParty) { let props = '' if (stylesheets?.length > 0) { - // TODO: Remove ts-ignore after new