profile
viewpoint

Ask questionsPossibly throwing different promises in Suspense causing the suspended tree to update unnecessarily

Describe the bug I think react-query throws different promises causing React to throw away the entire tree. It's very possible that I'm missing something on how Suspense works though.

Not really sure if it's a bug in react-query, react or the expected behaviour.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/restless-night-yynbz?fontsize=14&hidenavigation=1&theme=dark
  2. Check the console
  3. See multiple state initializer logs in the console

Expected behavior

State initializer only called once

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Firefox
  • Version: 80

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser: [e.g. stock browser, safari]
  • Version: [e.g. 22]

Additional context

N/A

tannerlinsley/react-query

Answer questions alexandernanberg

Tried it with concurrent mode and then it only calculates twice, so it might be a bug in React or simply expected in sync mode.

useful!
source:https://uonfu.com/
Github User Rank List