Open LarsFlieger opened 11 months ago
Same problem here! Appreciate a quick fix
duplicate of #2702
For future readers: note that #2702 was closed in favor of this issue.
I'm also running into this. I can use 2 suspended queries with no issues, but adding a 3rd throws these errors.
I also encountered this error. I did a little research and it seems that this only reproduces when using the 'use' provided by React. If I always use the 'use' that SWR implements, there seemed to be no problem. https://github.com/vercel/swr/blob/main/src/core/use-swr.ts#L42-L76
@promer94 How about always using the uses implemented by SWR as a tentative solution? Users encountering this bug have not been able to upgrade from version 2.1.5.
hey I have the same problem I have 3 SWR inside the suspend and I get this error.
Bug report
Description / Observed Behavior
In a Next.js project using SWR with Suspense, an issue arises when more than two
useSWR
hooks are used within a single component. The errors encountered are:The issue occurs in
Component.tsx
, where three fetch operations are initiated usinguseSWR
withsuspense: true
. The intention is to perform three separate data fetches with delays and console log the outputs.Expected Behavior
The expectation is that using multiple
useSWR
hooks in a single component should work seamlessly, particularly when leveraging Suspense in React.Repro Steps / Code Example
A minimal reproduction of this issue is available in this GitHub repository. The component tries to perform three separate data fetches with a delay function, using SWR with Suspense.
Additional Context
SWR version: ^2.2.4 React version: ^18 Next.js version: 14.0.3
I welcome any feedback or suggestions to fix this problem. If anyone has encountered similar issues or has insights into resolving this, please feel free to contribute. Collaborative efforts to debug and find a solution are highly appreciated.