Skip to content

Commit a9fe70e

Browse files
author
Sravan S
authored
fix: Race condition in disconnect/connect (#648)
When there is only single instance of SDK, and disconnect call take longer than next connect call Solution: Set `newInstance: true` when initializing SDK instance Fixes: https://sendbird.atlassian.net/browse/UIKIT-4193
1 parent 45c31de commit a9fe70e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/lib/hooks/useConnect/__test__/setupConnection.spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ describe('useConnect/setupConnection/setUpParams', () => {
127127
// @ts-ignore
128128
expect(require('@sendbird/chat').init).toBeCalledWith({
129129
appId,
130+
newInstance: true,
130131
modules: [
131132
// @ts-ignore
132133
new (require('@sendbird/chat/groupChannel').GroupChannelModule)(),
@@ -144,6 +145,7 @@ describe('useConnect/setupConnection/setUpParams', () => {
144145
// @ts-ignore
145146
expect(require('@sendbird/chat').init).toBeCalledWith({
146147
appId,
148+
newInstance: true,
147149
modules: [
148150
// @ts-ignore
149151
new (require('@sendbird/chat/groupChannel').GroupChannelModule)(),

src/lib/hooks/useConnect/setupConnection.ts

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function setUpParams({
3636
new GroupChannelModule(),
3737
new OpenChannelModule(),
3838
],
39+
newInstance: true,
3940
};
4041
if (customApiHost) {
4142
params['customApiHost'] = customApiHost;

0 commit comments

Comments
 (0)