Skip to content

Commit 022fbd8

Browse files
committed
fix: thread resetting after reconnection (#3492)
The crux of this issue is mostly explained [here](GetStream/stream-chat-js#1702). <!-- Provide a description of the implementation --> <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <!-- Explain how this change can be tested (or why it can't be tested) --> - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
1 parent dd234db commit 022fbd8

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

examples/ExpoMessaging/yarn.lock

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6043,7 +6043,22 @@ stream-chat-react-native-core@8.1.0:
60436043
version "0.0.0"
60446044
uid ""
60456045

6046-
stream-chat@^9.36.0, stream-chat@^9.9.0:
6046+
stream-chat@^9.36.1:
6047+
version "9.36.2"
6048+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.2.tgz#cd2cfac1f8d7b045c34dce51e2de1cb66bf288f5"
6049+
integrity sha512-sSCxTXJOf0BLDMZ2/cqvFged/LLbiWoIhs7v3UsRj0EM0T8tTam7zpU77TSccNDlK5j1C1/llSUVyMLc7aCDsA==
6050+
dependencies:
6051+
"@types/jsonwebtoken" "^9.0.8"
6052+
"@types/ws" "^8.5.14"
6053+
axios "^1.12.2"
6054+
base64-js "^1.5.1"
6055+
form-data "^4.0.4"
6056+
isomorphic-ws "^5.0.0"
6057+
jsonwebtoken "^9.0.3"
6058+
linkifyjs "^4.3.2"
6059+
ws "^8.18.1"
6060+
6061+
stream-chat@^9.9.0:
60476062
version "9.36.0"
60486063
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.0.tgz#154e0d6bdf8b15e97a6d9718c655d2ede34f6f25"
60496064
integrity sha512-D1b5THI4UbnvsEcJyUv1tUIgK6lCYT+aStrV+87mdrM9owX+WUpKaWFkxz/Ug+DOrJtTazvfuzvpJMyDi82NXA==

examples/SampleApp/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8364,10 +8364,10 @@ stream-chat-react-native-core@8.1.0:
83648364
version "0.0.0"
83658365
uid ""
83668366

8367-
stream-chat@^9.35.1:
8368-
version "9.35.1"
8369-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.35.1.tgz#d828854a9c27ea7e45e6642d9107966c6606f552"
8370-
integrity sha512-649sgO7+llFuW+y/Ja0K4d94aUC+EMxYUVo5mq5AFGT86vUAIXmRIMVHYHA/jw4MYoqfWAFrDK6L9Rhyn/eMkQ==
8367+
stream-chat@^9.36.1:
8368+
version "9.36.2"
8369+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.2.tgz#cd2cfac1f8d7b045c34dce51e2de1cb66bf288f5"
8370+
integrity sha512-sSCxTXJOf0BLDMZ2/cqvFged/LLbiWoIhs7v3UsRj0EM0T8tTam7zpU77TSccNDlK5j1C1/llSUVyMLc7aCDsA==
83718371
dependencies:
83728372
"@types/jsonwebtoken" "^9.0.8"
83738373
"@types/ws" "^8.5.14"

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"path": "0.12.7",
8585
"react-native-markdown-package": "1.8.2",
8686
"react-native-url-polyfill": "^2.0.0",
87-
"stream-chat": "^9.36.0",
87+
"stream-chat": "^9.36.1",
8888
"use-sync-external-store": "^1.5.0"
8989
},
9090
"peerDependencies": {

package/src/components/Channel/Channel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ const ChannelWithContext = (props: PropsWithChildren<ChannelPropsWithContext>) =
11261126
const parentID = thread.id;
11271127

11281128
const limit = 50;
1129-
channel.state.threads[parentID] = [];
1129+
// channel.state.threads[parentID] = [];
11301130
const queryResponse = await channel.getReplies(parentID, {
11311131
limit,
11321132
});

package/src/components/Chat/Chat.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ const ChatWithContext = (props: PropsWithChildren<ChatProps>) => {
191191
client.deviceIdentifier = { os: `${Platform.OS} ${Platform.Version}` };
192192
// This is to disable recovery related logic in js client, since we handle it in this SDK
193193
client.recoverStateOnReconnect = false;
194+
client.preventThreadCleanup = true;
194195
client.persistUserOnConnectionFailure = enableOfflineSupport;
195196
}
196197

package/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8352,10 +8352,10 @@ stdin-discarder@^0.2.2:
83528352
resolved "https://registry.yarnpkg.com/stdin-discarder/-/stdin-discarder-0.2.2.tgz#390037f44c4ae1a1ae535c5fe38dc3aba8d997be"
83538353
integrity sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==
83548354

8355-
stream-chat@^9.36.0:
8356-
version "9.36.0"
8357-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.0.tgz#154e0d6bdf8b15e97a6d9718c655d2ede34f6f25"
8358-
integrity sha512-D1b5THI4UbnvsEcJyUv1tUIgK6lCYT+aStrV+87mdrM9owX+WUpKaWFkxz/Ug+DOrJtTazvfuzvpJMyDi82NXA==
8355+
stream-chat@^9.36.1:
8356+
version "9.36.2"
8357+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.2.tgz#cd2cfac1f8d7b045c34dce51e2de1cb66bf288f5"
8358+
integrity sha512-sSCxTXJOf0BLDMZ2/cqvFged/LLbiWoIhs7v3UsRj0EM0T8tTam7zpU77TSccNDlK5j1C1/llSUVyMLc7aCDsA==
83598359
dependencies:
83608360
"@types/jsonwebtoken" "^9.0.8"
83618361
"@types/ws" "^8.5.14"

0 commit comments

Comments
 (0)