Dynamic Component is rendered statically when loading.tsx is present beside the layout #58686
Open
1 task done
Labels
bug
Issue was opened via the bug report template.
Pages Router
Related to Pages Router.
stale
The issue has not seen recent activity.
Link to the code that reproduces this issue
https://github.com/imbhargav5/nextjs-loading-error-reproduction
To Reproduce
yarn build
Current vs. Expected behavior
I put a fake wait promise within a dynamic layout. (See
/src/app/dynamic/layout.tsx
). And I put a loading.tsx file to stream render the response.Current behaviour
When this project is built, this is the odd behaviour.
With loading.tsx present beside the layout.tsx with force-dynamic behaviour present, this fakeWait function is being called during the build step.
Without loading.tsx present, it doesn't get called.
Expected behaviour
Irrespective of loading.tsx being present or not, fakeWait function should never be called as this layout is not static and it should not be built statically.
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 Binaries: Node: 20.4.0 npm: 9.7.2 Yarn: 1.22.18 pnpm: N/A Relevant Packages: next: 14.0.4-canary.5 eslint-config-next: 14.0.3 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router, Data fetching (gS(S)P, getInitialProps)
Additional context
The text was updated successfully, but these errors were encountered: