diff --git a/packages/next/src/client/components/layout-router.tsx b/packages/next/src/client/components/layout-router.tsx index a6ea8659406fb..f345381af034e 100644 --- a/packages/next/src/client/components/layout-router.tsx +++ b/packages/next/src/client/components/layout-router.tsx @@ -450,10 +450,10 @@ function InnerLayoutRouter({ // It's important that we mark this as resolved, in case this branch is replayed, we don't want to continously re-apply // the patch to the tree. childNode.lazyDataResolved = true - - // Suspend infinitely as `changeByServerResponse` will cause a different part of the tree to be rendered. - use(unresolvedThenable) as never } + // Suspend infinitely as `changeByServerResponse` will cause a different part of the tree to be rendered. + // A falsey `resolvedRsc` indicates missing data -- we should not commit that branch, and we need to wait for the data to arrive. + use(unresolvedThenable) as never } // We use `useDeferredValue` to handle switching between the prefetched and diff --git a/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/loading.js b/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/loading.js index 3921b6a73d10f..1fc5ff4960f62 100644 --- a/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/loading.js +++ b/test/e2e/app-dir/navigation/app/metadata-await-promise/nested/loading.js @@ -1,9 +1,3 @@ -'use client' -import { useEffect } from 'react' - export default function Loading() { - useEffect(() => { - window.shownLoading = true - }, []) return