vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.62k stars 26.82k forks source link

[AppDir] Page navigation with start transition is waiting for Suspended components #46892

Open schemburkar opened 1 year ago

schemburkar commented 1 year ago

Verify canary release

Provide environment information

Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Home Single Language
    Binaries:
      Node: 18.5.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.2.4-canary.5
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

https://github.com/vercel/next.js/files/10912131/poc-rsc.zip)

To Reproduce

Describe the Bug

The page has dynamic content simulated via a 5 sec Promise. When navigating via router/navigation APIs, and using startTransition to show user progress of the nav the behavior is as follows:

This is contrary to the browser page loading behavior where the async component is under suspense and page is shown quickly. The same behavior should be available when navigating using router and transitions.

POC poc-rsc.zip

Expected Behavior

The expected behavior is as follows:

Expected behavior sample: image

For this example,

Which browser are you using? (if relevant)

Latest

How are you deploying your application? (if relevant)

next dev

imownbey commented 1 year ago

I believe I am also seeing this

polnikale commented 1 year ago

Happened for me as well. I think the issue here is that you're not adding the loading.tsx file

schemburkar commented 1 year ago

Happened for me as well. I think the issue here is that you're not adding the loading.tsx file

@polnikale This has no effect on the bug. I have added loading.tsx, updated repro: poc-rsc2.zip

The expectation is that on clicking the button, the page transitions should complete immediately as all delayed content is wrapped in the suspense boundary.