question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React experimental concurrent issue

See original GitHub issue

https://github.com/facebook/react/pull/18838

I tried swr with suspense mode, with a recent 0.0.0-experimental-7f28234f8 react build, and I get errors Can't perform a React state update on a component that hasn't mounted yet for each useSWR call.

This indicates that there’s a side-effect spawned during render, that then asynchronously tries to set state when the response comes back. E.g. kick off a request and then setState with the result. It’s a common mistake when implementing Suspense.

This should be done in useEffect.

Does this make sense to you?

Unfortunately I can’t help you a lot more than that, it doesn’t help to where the error comes exactly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
huozhicommented, Nov 19, 2020

@huw @Jakst 0.3.9 should fix this issue. could you bump version to try again? thanks!

2reactions
bradenhscommented, Jul 8, 2020
Screen Shot 2020-07-08 at 12 45 58 PM

Here’s a codesandbox link: https://codesandbox.io/s/quirky-burnell-cn51p?file=/src/App.tsx. The problem only appears when there are multiple useSWR hooks used. Also, the warning doesn’t appear on the initial load of the page. You have to refresh the codesandbox preview specifically for some reason (I’m guessing that’s a codesandbox specific issue though since locally I see the warning on the initial load).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing Concurrent Mode (Experimental) - React
In Concurrent Mode, rendering is not blocking. It is interruptible. This improves the user experience. It also unlocks new features that weren't possible...
Read more >
What happened to concurrent "mode"? #64 - reactwg/react-18
In the Plan for React 18, we shared that the new strategy is to allow users to upgrade React 18 with no changes...
Read more >
Experimental React - Concurrent Mode is Coming - GrapeCity
In Concurrent Mode, React can pause expensive, non-urgent components from rendering and focus on more immediate or urgent behaviors like UI ...
Read more >
Concurrent Rendering in React 18 - Telerik
Concurrent Mode was introduced as an experimental feature. In favor of a more gradual adoption plan that allows you to opt in to...
Read more >
React: Rendering using Concurrent Mode and Suspense
Understanding React's experimental Concurrent and Suspense. ... Concurrent rendering solves many common page load issues like block ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found