We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bdf80b6 commit 55cd5a1Copy full SHA for 55cd5a1
src/components/ChannelList/hooks/useMemberUpdatedListener.ts
@@ -38,8 +38,9 @@ export const useMemberUpdatedListener = <SCG extends ExtendableGenerics>({
38
newChannels.splice(targetChannelIndex, 1);
39
}
40
41
- const lastPinnedChannelIndex = findLastPinnedChannelIndex({ channels: newChannels }) ?? 0;
42
- const newTargetChannelIndex = lastPinnedChannelIndex + 1;
+ const lastPinnedChannelIndex = findLastPinnedChannelIndex({ channels: newChannels });
+ const newTargetChannelIndex =
43
+ typeof lastPinnedChannelIndex === 'number' ? lastPinnedChannelIndex + 1 : 0;
44
45
// skip re-render if the position of the channel does not change
46
if (currentChannels[newTargetChannelIndex] === targetChannel) {
0 commit comments