Skip to content

Commit ac496a3

Browse files
committed
fix: catch exception from applicationUserListQuery (#236)
1 parent 812e7e0 commit ac496a3

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Fixes:
66
ESM library should have "type": "module" (package.json file that is going to /dist)
77
This fixes Cannot use import outside module issue in next.js
88
* Add optional chaining for createApplicationUserList
9+
* Fix QueryInProgress warning:
10+
React 18 strict mode glitch that causes useEffect to run twice
911
* Cannot connect sometimes when customApiHost is empty
1012
Connection couldnt be established with no error message when customApiHost and customWebSocketHost
1113
were passed as empty string

src/smart-components/CreateChannel/components/InviteUsers/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const InviteUsers: React.FC<InviteUsersProps> = ({
4141
const globalStore = useSendbirdStateContext();
4242
const userId = globalStore?.config?.userId;
4343
const sdk = globalStore?.stores?.sdkStore?.sdk as SendbirdGroupChat;
44+
const logger = globalStore?.config?.logger;
4445
const idsToFilter = [userId];
4546
const [users, setUsers] = useState([]);
4647
const [selectedUsers, setSelectedUsers] = useState({});
@@ -55,9 +56,12 @@ const InviteUsers: React.FC<InviteUsersProps> = ({
5556
useEffect(() => {
5657
const applicationUserListQuery = userQueryCreator;
5758
setUsersDataSource(applicationUserListQuery);
58-
applicationUserListQuery.next().then((users_) => {
59-
setUsers(users_);
60-
});
59+
// @ts-ignore
60+
if (!applicationUserListQuery?.isLoading) {
61+
applicationUserListQuery.next().then((users_) => {
62+
setUsers(users_);
63+
});
64+
}
6165
}, []);
6266

6367
return (

0 commit comments

Comments
 (0)