Skip to content

Commit

Permalink
feat: do not delete the active channel if offlineMode is true (#1116)
Browse files Browse the repository at this point in the history
* fix: do not delete active channels when offlineMode is true

* fix: set offlineMode to false when an explicit call to channel.query is done
  • Loading branch information
khushal87 authored Apr 24, 2023
1 parent 64e9165 commit 2004e28
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
1 change: 1 addition & 0 deletions src/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
const { messageSet } = this._initializeState(state, messageSetToAddToIfDoesNotExist);

this.data = state.channel;
this.offlineMode = false;

this.getClient().dispatchEvent({
type: 'channels.queried',
Expand Down
11 changes: 0 additions & 11 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1572,17 +1572,6 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
channels.push(c);
}

if (!offlineMode) {
// If the channels are coming from server, then clear out the
// previously help offline channels.
for (const key in this.activeChannels) {
const channel = this.activeChannels[key];
if (channel.offlineMode) {
delete this.activeChannels[key];
}
}
}

return channels;
}

Expand Down

0 comments on commit 2004e28

Please sign in to comment.