T
TanStack•15mo ago
mute-gold

page re-renders 100s of times when using with Wagmi (and SWR)

Just asking here, in hopes someone has came across this. We are using a stack, which is roughly composed of * next.js (pages) * wagmi (with @tanstack/react-query) * swr * and a lot of other libs on top of that I am seeing a weird behavior, which is that, whenever I navigate between the pages, if the page that I leave interacts with the wallet in any way, let's say by calling useAccount(), the page re-renders 100s of times. I've tried to add / remove things to rule out what could be causing this, but I think the above-mentioned packages could be contributing toward this. I feel like there's something going on with the tanstack query being "revalidated" for some reason, but I have no proof of this, and I'm not even sure what that even does in the context of wagmi. Also, the behavior seems to be the same for all browsers, but it is much more noticeable in non chromium browsers, but I guess that is due to how the respective browsers handle these kind of things Super thankful for any help 🙇 thanks
1 Reply
mute-gold
mute-goldOP•15mo ago
figured it out. tldr I had to add ssr: true to my wagmi config

Did you find this page helpful?