Skip to content

Commit 715df82

Browse files
authored
fix: thread resetting after reconnection (#3492)
## 🎯 Goal The crux of this issue is mostly explained [here](GetStream/stream-chat-js#1702). ## πŸ›  Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- 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> ## πŸ§ͺ Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## β˜‘οΈ Checklist - [ ] 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 2b04060 commit 715df82

File tree

5 files changed

+14
-61
lines changed

5 files changed

+14
-61
lines changed

β€Žexamples/ExpoMessaging/yarn.lockβ€Ž

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,9 +1587,9 @@
15871587
invariant "^2.2.4"
15881588

15891589
"@gorhom/bottom-sheet@^5.1.6":
1590-
version "5.2.6"
1591-
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.2.6.tgz#5f2045f6ca965383afe39f7dfa3afad1502b7467"
1592-
integrity sha512-vmruJxdiUGDg+ZYcDmS30XDhq/h/+QkINOI5LY/uGjx8cPGwgJW0H6AB902gNTKtccbiKe/rr94EwdmIEz+LAQ==
1590+
version "5.2.8"
1591+
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-5.2.8.tgz#25e49122c30ffe83d3813b3bcf3dec39f3359aeb"
1592+
integrity sha512-+N27SMpbBxXZQ/IA2nlEV6RGxL/qSFHKfdFKcygvW+HqPG5jVNb1OqehLQsGfBP+Up42i0gW5ppI+DhpB7UCzA==
15931593
dependencies:
15941594
"@gorhom/portal" "1.0.14"
15951595
invariant "^2.2.4"
@@ -4278,22 +4278,6 @@ json5@^2.2.3:
42784278
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
42794279
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
42804280

4281-
jsonwebtoken@^9.0.2:
4282-
version "9.0.2"
4283-
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz#65ff91f4abef1784697d40952bb1998c504caaf3"
4284-
integrity sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==
4285-
dependencies:
4286-
jws "^3.2.2"
4287-
lodash.includes "^4.3.0"
4288-
lodash.isboolean "^3.0.3"
4289-
lodash.isinteger "^4.0.4"
4290-
lodash.isnumber "^3.0.3"
4291-
lodash.isplainobject "^4.0.6"
4292-
lodash.isstring "^4.0.1"
4293-
lodash.once "^4.0.0"
4294-
ms "^2.1.1"
4295-
semver "^7.5.4"
4296-
42974281
jsonwebtoken@^9.0.3:
42984282
version "9.0.3"
42994283
resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz#6cd57ab01e9b0ac07cb847d53d3c9b6ee31f7ae2"
@@ -4310,15 +4294,6 @@ jsonwebtoken@^9.0.3:
43104294
ms "^2.1.1"
43114295
semver "^7.5.4"
43124296

4313-
jwa@^1.4.1:
4314-
version "1.4.2"
4315-
resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.2.tgz#16011ac6db48de7b102777e57897901520eec7b9"
4316-
integrity sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==
4317-
dependencies:
4318-
buffer-equal-constant-time "^1.0.1"
4319-
ecdsa-sig-formatter "1.0.11"
4320-
safe-buffer "^5.0.1"
4321-
43224297
jwa@^2.0.1:
43234298
version "2.0.1"
43244299
resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.1.tgz#bf8176d1ad0cd72e0f3f58338595a13e110bc804"
@@ -4328,14 +4303,6 @@ jwa@^2.0.1:
43284303
ecdsa-sig-formatter "1.0.11"
43294304
safe-buffer "^5.0.1"
43304305

4331-
jws@^3.2.2:
4332-
version "3.2.2"
4333-
resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304"
4334-
integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==
4335-
dependencies:
4336-
jwa "^1.4.1"
4337-
safe-buffer "^5.0.1"
4338-
43394306
jws@^4.0.1:
43404307
version "4.0.1"
43414308
resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.1.tgz#07edc1be8fac20e677b283ece261498bd38f0690"
@@ -6071,10 +6038,10 @@ stream-chat-react-native-core@8.1.0:
60716038
version "0.0.0"
60726039
uid ""
60736040

6074-
stream-chat@^9.33.0:
6075-
version "9.36.0"
6076-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.0.tgz#154e0d6bdf8b15e97a6d9718c655d2ede34f6f25"
6077-
integrity sha512-D1b5THI4UbnvsEcJyUv1tUIgK6lCYT+aStrV+87mdrM9owX+WUpKaWFkxz/Ug+DOrJtTazvfuzvpJMyDi82NXA==
6041+
stream-chat@^9.36.1, stream-chat@^9.9.0:
6042+
version "9.36.1"
6043+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.1.tgz#b452369fa933c156fa57f52a8c3a276c36fc5de7"
6044+
integrity sha512-bui8a9kjqd80LXXMbvIzrdg2FL7GIgU/Z/reliPgdstIe3HgLfECS8wIAJSySULemWoMNTGjAy8+o9oOYH2Plg==
60786045
dependencies:
60796046
"@types/jsonwebtoken" "^9.0.8"
60806047
"@types/ws" "^8.5.14"
@@ -6086,21 +6053,6 @@ stream-chat@^9.33.0:
60866053
linkifyjs "^4.3.2"
60876054
ws "^8.18.1"
60886055

6089-
stream-chat@^9.9.0:
6090-
version "9.20.3"
6091-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.20.3.tgz#5f47d6f46d146202c743282f5fb7350f4a640922"
6092-
integrity sha512-206Lea0ZAVWbfYZkIwLG5m+++ELD3f8EAEL/YzbMDL++E2vU2WhQ2d1HNb1ROXURZUF0Sy845htTw1rwnahomw==
6093-
dependencies:
6094-
"@types/jsonwebtoken" "^9.0.8"
6095-
"@types/ws" "^8.5.14"
6096-
axios "^1.12.2"
6097-
base64-js "^1.5.1"
6098-
form-data "^4.0.4"
6099-
isomorphic-ws "^5.0.0"
6100-
jsonwebtoken "^9.0.2"
6101-
linkifyjs "^4.3.2"
6102-
ws "^8.18.1"
6103-
61046056
strict-uri-encode@^2.0.0:
61056057
version "2.0.0"
61066058
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"

β€Žpackage/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"path": "0.12.7",
8383
"react-native-markdown-package": "1.8.2",
8484
"react-native-url-polyfill": "^2.0.0",
85-
"stream-chat": "^9.33.0",
85+
"stream-chat": "^9.36.1",
8686
"use-sync-external-store": "^1.5.0"
8787
},
8888
"peerDependencies": {

β€Žpackage/src/components/Channel/Channel.tsxβ€Ž

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

11041104
const limit = 50;
1105-
channel.state.threads[parentID] = [];
1105+
// channel.state.threads[parentID] = [];
11061106
const queryResponse = await channel.getReplies(parentID, {
11071107
limit,
11081108
});

β€Ž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
@@ -8335,10 +8335,10 @@ stdin-discarder@^0.2.2:
83358335
resolved "https://registry.yarnpkg.com/stdin-discarder/-/stdin-discarder-0.2.2.tgz#390037f44c4ae1a1ae535c5fe38dc3aba8d997be"
83368336
integrity sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==
83378337

8338-
stream-chat@^9.33.0:
8339-
version "9.33.0"
8340-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.33.0.tgz#3da6582ade9a22a808abe7f443b08137705bf792"
8341-
integrity sha512-JdeR6Nq2QEKBIKZsW8wnGa04pTHCiWmdIOqvWUVJ4DtmLzJ9oBBeBnHvPx1Q+RKbvpZqfjwvYaCwKY5ZFq+FxQ==
8338+
stream-chat@^9.36.1:
8339+
version "9.36.1"
8340+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.36.1.tgz#b452369fa933c156fa57f52a8c3a276c36fc5de7"
8341+
integrity sha512-bui8a9kjqd80LXXMbvIzrdg2FL7GIgU/Z/reliPgdstIe3HgLfECS8wIAJSySULemWoMNTGjAy8+o9oOYH2Plg==
83428342
dependencies:
83438343
"@types/jsonwebtoken" "^9.0.8"
83448344
"@types/ws" "^8.5.14"

0 commit comments

Comments
Β (0)