Skip to content

Commit

Permalink
Clear unnecessary code (#38900)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
Yuddomack committed Jul 22, 2022
1 parent d034fff commit 2a1dc3c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/next/shared/lib/router/router.ts
Expand Up @@ -1604,18 +1604,10 @@ export default class Router implements BaseRouter {
}

try {
let Component: ComponentType
let styleSheets: StyleSheetTuple[]
let props: Record<string, any> | 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,
Expand Down

0 comments on commit 2a1dc3c

Please sign in to comment.