Closed 0xAskar closed 3 weeks ago
@0xAskar What browser are you using ? Can you share a small reproducible example ?
@magiziz I used both Firefox and Chrome. I can perhaps release a reproducible example a bit later in the day. But, I don't seem to problem disrupt functionality in production, just in developing.
Would it make sense to add just error handling that ensures Navigator isn't an empty object as well. Would it be possible to update the library to have that in the getBrowser function?
@0xAskar Yeah i'll get that fixed, but it's hard for me to debug if i can't reproduce this on my end. Whenever you have time can you just link a small reproducible example here ? I can't seem to get that error in the console for some reason.
@magiziz hey mate, i just added a reproducible example by stripping down every file or component in my project and just keeping the bare mimium. the package json is mostly the same. Also, if you're going to fix it by just adding another clause in the if, could I do that lol? I have never publicly fixed a bug on an open sourced project and would love to learn how.
I don't know if there is a better way but i made a public repo, let me know if you get the problem, because i still do with this stripped down repo https://github.com/0xAskar/RainbowKitNavBug
@0xAskar I can't seem to reproduce this locally on chrome. I only see the next-auth
errors and not the navigator.userAgent
error.
If you want to fix this you're welcome to open a PR, but this should be an easy fix i just can't seem to reproduce this on my end.
@magiziz Hey, so just to check my sanity, I deleted the reprod. example and recloned it, installed the libraries, and re-ran. I still get the same error. I assume this is just some local error but still pops up due to lack of error handling if the object is empty.
anyways, i created the pull request, lmk if anything needs to change and we can update it. That would make developing much easier to do, because rn i have to amend the index file within the rainbowkit modules myself
@0xAskar Thanks! I'll take a look 👍
Is there an existing issue for this?
RainbowKit Version
2.1.2
wagmi Version
2.9.10
Current Behavior
The problem is that after migrating and following the migration guides to the 2.x rainbow wallet, and the same for wagmi and viem, I'm getting a weird problem where the navigator in the
node_modules/@rainbow-me/rainbowkit/dist/index.js
is not being recognized, such that the function,getBrowser()
has a problem whennavigator.userAgent.toLowercase()
is called because navigator is an empty Object (I console.log'ed it and it showed that).If I just return normally with an if statement checking if its empty, my code runs as functioned. But I assume you shouldn't be changing the node modules for rainbow kits. So any idea why this is happening?
So, please see the full error below:
I've attached my app.js below