Skip to content

Commit 3acc9c4

Browse files
authored
fix: channel muted state update for offline enabled case (#2992)
1 parent 802aad1 commit 3acc9c4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

package/src/components/ChannelPreview/hooks/useIsChannelMuted.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ export const useIsChannelMuted = <
1212
channel: Channel<StreamChatGenerics>,
1313
) => {
1414
const { client } = useChatContext<StreamChatGenerics>();
15-
const initialized = channel?.initialized;
1615

17-
const [muted, setMuted] = useState(() => initialized && channel.muteStatus());
16+
const [muted, setMuted] = useState(() => channel.muteStatus());
1817

1918
useEffect(() => {
2019
const handleEvent = () => {
21-
setMuted(initialized && channel.muteStatus());
20+
setMuted(channel.muteStatus());
2221
};
2322

2423
client.on('notification.channel_mutes_updated', handleEvent);
2524
return () => client.off('notification.channel_mutes_updated', handleEvent);
26-
}, [channel, client, initialized, muted]);
25+
}, [channel, client, muted]);
2726

2827
return muted || { createdAt: null, expiresAt: null, muted: false };
2928
};

0 commit comments

Comments
 (0)