Skip to content

Commit

Permalink
hoist def
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 6, 2022
1 parent 848ad5f commit dd10790
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/next/client/components/app-router.client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function urlToUrlWithoutFlightMarker(url: string): URL {
return urlWithoutFlightParameters
}

const HotReloader =
process.env.NODE_ENV === 'production' ? null : require('./hot-reloader')

/**
* Fetch the flight data for the provided url. Takes in the current router state to decide what to render server-side.
*/
Expand Down Expand Up @@ -347,16 +350,13 @@ export default function AppRouter({
url: canonicalUrl,
}}
>
{process.env.NODE_ENV === 'production'
? cache.subTreeData
: (() => {
const HotReloader = require('./hot-reloader')
return (
<HotReloader assetPrefix={assetPrefix}>
{cache.subTreeData}
</HotReloader>
)
})()}
{HotReloader ? (
<HotReloader assetPrefix={assetPrefix}>
{cache.subTreeData}
</HotReloader>
) : (
cache.subTreeData
)}
</LayoutRouterContext.Provider>
</AppRouterContext.Provider>
</GlobalLayoutRouterContext.Provider>
Expand Down

0 comments on commit dd10790

Please sign in to comment.