socket.io-react-hook icon indicating copy to clipboard operation
socket.io-react-hook copied to clipboard

sockets.current[namespaceKey] can be undefined in ioProvider.tsx

Open dufia opened this issue 1 year ago • 2 comments

I run into this issue where sockets.current[namespaceKey] can be undefined in ioProvider.tsx, I am referring to https://github.com/nitedani/socket.io-react-hook/blob/main/packages/socket.io-react-hook/src/IoProvider.tsx#L89.

Although it was semi reliably take place in my app when parent of component was re-rendering, I wasn't able to reproduce it with examples in your repo.

I ended up patching to (check if it's defined), I created this issue for visibility, in case someone else experiences the problem.

dufia avatar Jan 21 '24 11:01 dufia

@dufia

I run into this issue where sockets.current[namespaceKey] can be undefined in ioProvider.tsx, I am referring to https://github.com/nitedani/socket.io-react-hook/blob/main/packages/socket.io-react-hook/src/IoProvider.tsx#L89.

Although it was semi reliably take place in my app when parent of component was re-rendering, I wasn't able to reproduce it with examples in your repo.

I ended up patching to (check if it's defined), I created this issue for visibility, in case someone else experiences the problem.

Hello my friend, I am also experiencing the same problem.

Can you tell me with code how you solved this problem?

JungYOsup avatar Aug 09 '24 08:08 JungYOsup

Hey, I had to implement a custom solution instead of using this library

dufia avatar Aug 09 '24 10:08 dufia