stream-chat 9.50.0 → 9.50.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ import type { QueryThreadsOptions } from './types';
5
5
  import { WithSubscriptions } from './utils/WithSubscriptions';
6
6
  export declare const THREAD_MANAGER_INITIAL_STATE: {
7
7
  active: boolean;
8
+ wasActivatedAtLeastOnce: boolean;
8
9
  isThreadOrderStale: boolean;
9
10
  threads: never[];
10
11
  unreadThreadCount: number;
@@ -19,6 +20,12 @@ export declare const THREAD_MANAGER_INITIAL_STATE: {
19
20
  };
20
21
  export type ThreadManagerState = {
21
22
  active: boolean;
23
+ /**
24
+ * Whether the thread manager has been activated at least once in the current
25
+ * session (i.e. `activate()` was called). Used to avoid requerying threads
26
+ * on connection recovery for consumers that never actually activate the manager.
27
+ */
28
+ wasActivatedAtLeastOnce: boolean;
22
29
  isThreadOrderStale: boolean;
23
30
  lastConnectionDropAt: Date | null;
24
31
  pagination: ThreadManagerPagination;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat",
3
- "version": "9.50.0",
3
+ "version": "9.50.1",
4
4
  "description": "JS SDK for the Stream Chat API",
5
5
  "homepage": "https://getstream.io/chat/",
6
6
  "author": {
@@ -10,6 +10,7 @@ const DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
10
10
  const MAX_QUERY_THREADS_LIMIT = 25;
11
11
  export const THREAD_MANAGER_INITIAL_STATE = {
12
12
  active: false,
13
+ wasActivatedAtLeastOnce: false,
13
14
  isThreadOrderStale: false,
14
15
  threads: [],
15
16
  unreadThreadCount: 0,
@@ -25,6 +26,12 @@ export const THREAD_MANAGER_INITIAL_STATE = {
25
26
 
26
27
  export type ThreadManagerState = {
27
28
  active: boolean;
29
+ /**
30
+ * Whether the thread manager has been activated at least once in the current
31
+ * session (i.e. `activate()` was called). Used to avoid requerying threads
32
+ * on connection recovery for consumers that never actually activate the manager.
33
+ */
34
+ wasActivatedAtLeastOnce: boolean;
28
35
  isThreadOrderStale: boolean;
29
36
  lastConnectionDropAt: Date | null;
30
37
  pagination: ThreadManagerPagination;
@@ -90,7 +97,7 @@ export class ThreadManager extends WithSubscriptions {
90
97
  };
91
98
 
92
99
  public activate = () => {
93
- this.state.partialNext({ active: true });
100
+ this.state.partialNext({ active: true, wasActivatedAtLeastOnce: true });
94
101
  };
95
102
 
96
103
  public deactivate = () => {
@@ -197,8 +204,9 @@ export class ThreadManager extends WithSubscriptions {
197
204
 
198
205
  const throttledHandleConnectionRecovered = throttle(
199
206
  () => {
200
- const { lastConnectionDropAt } = this.state.getLatestValue();
201
- if (!lastConnectionDropAt) return;
207
+ const { lastConnectionDropAt, wasActivatedAtLeastOnce } =
208
+ this.state.getLatestValue();
209
+ if (!lastConnectionDropAt || !wasActivatedAtLeastOnce) return;
202
210
  this.reload({ force: true });
203
211
  },
204
212
  DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION,