Skip to content

Commit 1adf392

Browse files
committed
remove extra channel query
1 parent 3daf545 commit 1adf392

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/components/Channel/Channel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ const ChannelInner = <
466466
try {
467467
queryResponse = await channel.query({
468468
messages: { id_lt: oldestID, limit: perPage },
469+
watchers: { limit: perPage },
469470
});
470471
} catch (e) {
471472
console.warn('message pagination request failed with error', e);

src/components/Channel/__tests__/Channel.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ describe('Channel', () => {
407407
id_lt: messages[0].id,
408408
limit,
409409
},
410+
watchers: {
411+
limit,
412+
},
410413
}),
411414
);
412415

src/components/ChatAutoComplete/ChatAutoComplete.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
1+
import React, { useCallback, useMemo, useState } from 'react';
22
import debounce from 'lodash.debounce';
33

44
import { AutoCompleteTextarea } from '../AutoCompleteTextarea';
@@ -244,7 +244,7 @@ const UnMemoizedChatAutoComplete = <
244244
value,
245245
} = props;
246246

247-
const { channel, emojiConfig, thread } = useChannelContext<
247+
const { channel, emojiConfig } = useChannelContext<
248248
At,
249249
Ch,
250250
Co,
@@ -257,18 +257,6 @@ const UnMemoizedChatAutoComplete = <
257257

258258
const [searching, setSearching] = useState(false);
259259

260-
useEffect(() => {
261-
const getWatchers = async () => {
262-
await channel?.watch({
263-
watchers: { limit: 100, offset: 0 },
264-
});
265-
};
266-
267-
if (!thread) {
268-
getWatchers();
269-
}
270-
}, []);
271-
272260
const members = channel?.state?.members;
273261
const watchers = channel?.state?.watchers;
274262
const { emojiData, EmojiIndex } = emojiConfig || {};

0 commit comments

Comments
 (0)