Skip to content

Commit b8365ca

Browse files
authored
fix: update refreshList reference (#833)
fix: update `refreshList` reference for connection recovery to allow sort/filter changes.
1 parent 41231a0 commit b8365ca

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

package/src/components/ChannelList/hooks/listeners/useConnectionRecovered.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect } from 'react';
1+
import { useEffect, useRef } from 'react';
22

33
import { useChatContext } from '../../../../contexts/chatContext/ChatContext';
44

@@ -32,9 +32,12 @@ export const useConnectionRecovered = <
3232
}: Parameters) => {
3333
const { client } = useChatContext<At, Ch, Co, Ev, Me, Re, Us>();
3434

35+
const refRefreshList = useRef(refreshList);
36+
refRefreshList.current = refreshList;
37+
3538
useEffect(() => {
3639
const handleEvent = () => {
37-
refreshList();
40+
refRefreshList.current();
3841
setForceUpdate((count) => count + 1);
3942
};
4043

0 commit comments

Comments
 (0)