No wagmi config found. Ensure you have set up a config #3014
-
Hi all, Probably my case is an edge case but... I have a turborepo monorepo that includes a next.js v13 app and a custom react components library. I'm trying to create a sort of WalletConnect wrapper and this should be easy, just create a wrapper component. I did it and it works into the monorepo using the wagmi version 1.3.3. Then I published the react library (private repo) installed in a strach next.js app and this works, installed again into a new next.js app does not work. In the meanwhile, some other releases of wagmi were done and I really need that fix for some known issue but changing the wagmi version to >=1.3.4 errors happened into the monorepo too. The error were 2:
I tried to:
With these solutions, something changed:
I cannot share the original repo for reproduction, but, I replicated the issue in a new repo with the original status, so no SSR disable, no memo and no Singleton. Here the repo: https://github.com/francesco-gaglione/replicate Please can you help to understand what is happening? I think there is something borderline to be solved in the libraries. (the config issue of course, but something else too) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
The setup is incorrect, your wagmi config is initialised inside https://github.com/francesco-gaglione/replicate/blob/master/packages/react-components/src/components/wallet-connect/WalletConnectWrapper.tsx which is used inside app component. Next.js re-renders app component every time when global state like page route changes causing issues with wagmi. As I replied in your previous questions, you need to set wagmi up outside of react's render loop i.e. outside of next.js |
Beta Was this translation helpful? Give feedback.
-
@0xasimetriq yes I tried but didn't commit because the error is the same. Now I committed the changed you are mentioning but still same error. |
Beta Was this translation helpful? Give feedback.
Ah, you are using yarn. Is it yarn v1? We did get few reports about package inconsistencies when it is used, not much we can do there but you should be able to get everything going with npm / pnpm or latest yarn version (I believe they are on v3 now)