Skip to content

Commit

Permalink
try removing the cacheNode.lazyData null logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ztanner committed Feb 5, 2024
1 parent d2ab14d commit 8e93c13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions packages/next/src/client/components/layout-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,6 @@ function InnerLayoutRouter({
// When the data has not resolved yet `use` will suspend here.
const [flightData, overrideCanonicalUrl] = use(lazyData)

// segmentPath from the server does not match the layout's segmentPath
childNode.lazyData = null

// setTimeout is used to start a new transition during render, this is an intentional hack around React.
setTimeout(() => {
startTransition(() => {
Expand Down
10 changes: 5 additions & 5 deletions packages/next/src/shared/lib/router/action-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
ACTION_SERVER_ACTION,
ACTION_NAVIGATE,
ACTION_RESTORE,
ACTION_SERVER_PATCH,
} from '../../../client/components/router-reducer/router-reducer-types'
import type { ReduxDevToolsInstance } from '../../../client/components/use-reducer-with-devtools'
import { reducer } from '../../../client/components/router-reducer/router-reducer'
Expand Down Expand Up @@ -121,10 +120,11 @@ function dispatchAction(
reject: (reason: any) => void
} = { resolve: setState, reject: () => {} }

// most of the action types are async with the exception of restore & server patch
// for those cases, because the action is synchronous, we don't need to call setState
// to notify React of the pending promise.
if (payload.type !== ACTION_RESTORE && payload.type !== ACTION_SERVER_PATCH) {
// most of the action types are async with the exception of restore
// it's important that restore is handled quickly since it's fired on the popstate event
// and we don't want to add any delay on a back/forward nav
// this only creates a promise for the async actions
if (payload.type !== ACTION_RESTORE) {
// Create the promise and assign the resolvers to the object.
const deferredPromise = new Promise<AppRouterState>((resolve, reject) => {
resolvers = { resolve, reject }
Expand Down

0 comments on commit 8e93c13

Please sign in to comment.