From 2a1dc3c647ee28d858ebc818e8bbe86b39f770df Mon Sep 17 00:00:00 2001 From: Yuddomack <41747333+Yuddomack@users.noreply.github.com> Date: Sat, 23 Jul 2022 00:16:57 +0900 Subject: [PATCH] Clear unnecessary code (#38900) This always seems to execute. unless there is a special reason, I think it can declare and assign at the same time, how about this? ## 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) --- packages/next/shared/lib/router/router.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/next/shared/lib/router/router.ts b/packages/next/shared/lib/router/router.ts index a92c196473dc..c9b279a666f4 100644 --- a/packages/next/shared/lib/router/router.ts +++ b/packages/next/shared/lib/router/router.ts @@ -1604,18 +1604,10 @@ export default class Router implements BaseRouter { } try { - let Component: ComponentType - let styleSheets: StyleSheetTuple[] let props: Record | undefined - - if ( - typeof Component! === 'undefined' || - typeof styleSheets! === 'undefined' - ) { - ;({ page: Component, styleSheets } = await this.fetchComponent( - '/_error' - )) - } + const { page: Component, styleSheets } = await this.fetchComponent( + '/_error' + ) const routeInfo: CompletePrivateRouteInfo = { props,