You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When opening a <Channel> directly, with an uninitializedchannel the auto markRead functionality does not work.
Note that we are not coming from the ChannelList, but from one of our components directly opening a <Channel>.
In the initChannel useEffect, the unreadCount is not correct when read at the top, because the channel was not yet watched/initialized (which happens a few lines below)
console.warn('Channel watch request failed with error:',err);
setError(true);
errored=true;
}
}
Moving the const unreadCount = channel.countUnread(); after the .watch() solves this.
In initChannel when markRead is called (for a freshly initialized channel), the clientChannelConfig closure is still undefined, and markRead will do nothing.
clientChannelConfig will become defined only on the next render, but getChannelConfigSafely() is defined because we just called .watch()
When opening a
<Channel>
directly, with an uninitializedchannel
the automarkRead
functionality does not work.Note that we are not coming from the ChannelList, but from one of our components directly opening a
<Channel>
.Something like this
initChannel
useEffect, theunreadCount
is not correct when read at the top, because the channel was not yet watched/initialized (which happens a few lines below)stream-chat-react-native/package/src/components/Channel/Channel.tsx
Lines 827 to 843 in d443859
Moving the
const unreadCount = channel.countUnread();
after the.watch()
solves this.initChannel
whenmarkRead
is called (for a freshly initialized channel), theclientChannelConfig
closure is still undefined, and markRead will do nothing.clientChannelConfig
will become defined only on the next render, butgetChannelConfigSafely()
is defined because we just called.watch()
stream-chat-react-native/package/src/components/Channel/Channel.tsx
Lines 873 to 875 in d443859
stream-chat-react-native/package/src/components/Channel/Channel.tsx
Lines 947 to 952 in d443859
Changing
clientChannelConfig
togetChannelConfigSafely()
fixes the issueHere is a patch I generated for
stream-chat-react-native-core@6.7.1
using patch-package, which fixes the markRead issues on an un-initialized channelThis issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: