Skip to content

Showing React.Suspense fallback component works only on initial page render (not the same like in v6) #14692

@griffin94

Description

@griffin94

Reproduction

Expected Behavior ("react-router-dom": "^6.30.2")
https://codesandbox.io/p/devbox/happy-buck-ld5mh2

Wrong Behavior / Other than on v6 ("react-router": "7.11.0")
https://codesandbox.io/p/devbox/upbeat-julien-77xxtg

System Info

System:
    OS: Linux 6.1 Debian GNU/Linux 12 (bookworm) 12 (bookworm)
    CPU: (2) x64 AMD EPYC
    Memory: 984.72 MB / 4.01 GB
    Container: Yes
    Shell: Unknown
  Binaries:
    Node: 20.12.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.5.0 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/share/npm-global/bin/pnpm
  npmPackages:
    vite: ^6.0.3 => 6.3.5

Used Package Manager

npm

Expected Behavior

When I enter the page, I see the "Loader..." inscription. After 2 seconds, when data is ready, "Loader..." inscription disappears and I see list of user. Then I seek for "john" name, hit button and I see "Loader..." again. This is what I expect to be.

So I see Loader

  • when I enter the page (initial render)
  • whenever I submit Form Component which triggers loader function.

Actual Behavior

When you change dependency from [email protected] to react-router@7 it doesn't work the same way. I can see "Loader..." only on initial render.
Example code below:
https://codesandbox.io/p/devbox/upbeat-julien-77xxtg
I think every time loader function returns promise,
I should see React.Suspense fallback component, but now I cannot. If it is not a bug then how to achieve the same result like in v6?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions