Hi, I’m receiving this warning whenever
onMessageReceived is triggered
LogBox.js:173 Possible Unhandled Promise Rejection (id: 7): TypeError: Cannot read property 'onMessageReceived' of undefined TypeError: Cannot read property 'onMessageReceived' of undefined
The only thing that my
onMessageReceived handler do is to update the list of messages if the received channel is the current channel. This is the code that does the updating:
setMessages(items => [message, ...items]);
If I remove this line, the warning goes away.
This warning is blocking me because I have two
onMessageReceived handlers registered separately in two components but as soon as the first handler gets this warning, the second one wouldn’t run.
What’s weird is that the warning does not happen to
onMessageDeleted although they have almost the same logic inside.
Would appreciate some help here.