Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/channel_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,12 @@ export class ChannelState {
.state.updateUserReference(message.user, this._channel.cid);
}

if (initializing && message.id && this.threads[message.id]) {
if (
initializing &&
message.id &&
this.threads[message.id] &&
!this._channel.getClient().preventThreadCleanup
) {
// If we are initializing the state of channel (e.g., in case of connection recovery),
// then in that case we remove thread related to this message from threads object.
// This way we can ensure that we don't have any stale data in thread object
Expand Down
5 changes: 5 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ export class StreamChat {
* manually calling queryChannels endpoint.
*/
recoverStateOnReconnect?: boolean;
/**
* If true, we will not clean up threads when channel state is in initializing state.
* The main use case for SDKs who do independent state recovery for channels.
*/
preventThreadCleanup = false;
moderation: Moderation;
mutedChannels: ChannelMute[];
mutedUsers: Mute[];
Expand Down
Loading