stream-chat 9.54.2 → 9.54.4
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.
- package/dist/cjs/index.browser.js +22 -7
- package/dist/cjs/index.browser.js.map +2 -2
- package/dist/cjs/index.node.js +22 -7
- package/dist/cjs/index.node.js.map +2 -2
- package/dist/esm/index.mjs +22 -7
- package/dist/esm/index.mjs.map +2 -2
- package/package.json +1 -1
- package/src/channel_manager.ts +8 -4
- package/src/connection.ts +15 -1
package/package.json
CHANGED
package/src/channel_manager.ts
CHANGED
|
@@ -460,10 +460,14 @@ export class ChannelManager extends WithSubscriptions {
|
|
|
460
460
|
});
|
|
461
461
|
|
|
462
462
|
if (channelsFromDB) {
|
|
463
|
-
const offlineChannels = this.client.hydrateActiveChannels(
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
463
|
+
const offlineChannels = this.client.hydrateActiveChannels(
|
|
464
|
+
channelsFromDB,
|
|
465
|
+
{
|
|
466
|
+
offlineMode: true,
|
|
467
|
+
skipInitialization: [], // passing empty array will clear out the existing messages from channel state, this removes the possibility of duplicate messages
|
|
468
|
+
},
|
|
469
|
+
options,
|
|
470
|
+
);
|
|
467
471
|
|
|
468
472
|
this.state.partialNext({ channels: offlineChannels });
|
|
469
473
|
}
|
package/src/connection.ts
CHANGED
|
@@ -416,7 +416,21 @@ export class StableWSConnection {
|
|
|
416
416
|
this._destroyCurrentWSConnection();
|
|
417
417
|
|
|
418
418
|
if (options.refreshToken) {
|
|
419
|
-
|
|
419
|
+
try {
|
|
420
|
+
await this.client.tokenManager.loadToken();
|
|
421
|
+
} catch (error) {
|
|
422
|
+
// _reconnect() is not awaited by its callers, so a rejection here would be unhandled.
|
|
423
|
+
// Treat a failed refresh like a failed connect and retry with backoff.
|
|
424
|
+
this.isHealthy = false;
|
|
425
|
+
this.consecutiveFailures += 1;
|
|
426
|
+
this._log('_reconnect() - Failed to refresh the token', { error }, 'warn');
|
|
427
|
+
|
|
428
|
+
if (!this.isDisconnected) {
|
|
429
|
+
this._log('_reconnect() - Going to try to reload token and reconnect');
|
|
430
|
+
this._reconnect({ refreshToken: true });
|
|
431
|
+
}
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
420
434
|
|
|
421
435
|
// Another reconnect may have started while the token was loading, e.g. when
|
|
422
436
|
// the socket fires both an error and a close event.
|