@djangocfg/centrifugo 2.1.224 → 2.1.225

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/centrifugo",
3
- "version": "2.1.224",
3
+ "version": "2.1.225",
4
4
  "description": "Production-ready Centrifugo WebSocket client for React with real-time subscriptions, RPC patterns, and connection state management",
5
5
  "keywords": [
6
6
  "centrifugo",
@@ -63,10 +63,10 @@
63
63
  "centrifuge": "^5.2.2"
64
64
  },
65
65
  "peerDependencies": {
66
- "@djangocfg/api": "^2.1.224",
67
- "@djangocfg/i18n": "^2.1.224",
68
- "@djangocfg/ui-core": "^2.1.224",
69
- "@djangocfg/ui-tools": "^2.1.224",
66
+ "@djangocfg/api": "^2.1.225",
67
+ "@djangocfg/i18n": "^2.1.225",
68
+ "@djangocfg/ui-core": "^2.1.225",
69
+ "@djangocfg/ui-tools": "^2.1.225",
70
70
  "consola": "^3.4.2",
71
71
  "lucide-react": "^0.545.0",
72
72
  "moment": "^2.30.1",
@@ -74,11 +74,11 @@
74
74
  "react-dom": "^19.1.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@djangocfg/api": "^2.1.224",
78
- "@djangocfg/i18n": "^2.1.224",
79
- "@djangocfg/typescript-config": "^2.1.224",
80
- "@djangocfg/ui-core": "^2.1.224",
81
- "@djangocfg/ui-tools": "^2.1.224",
77
+ "@djangocfg/api": "^2.1.225",
78
+ "@djangocfg/i18n": "^2.1.225",
79
+ "@djangocfg/typescript-config": "^2.1.225",
80
+ "@djangocfg/ui-core": "^2.1.225",
81
+ "@djangocfg/ui-tools": "^2.1.225",
82
82
  "@types/node": "^24.7.2",
83
83
  "@types/react": "^19.1.0",
84
84
  "@types/react-dom": "^19.1.0",
@@ -316,12 +316,13 @@ function CentrifugoProviderInner({
316
316
  reconnectStoppedRef.current = false;
317
317
  } catch (err) {
318
318
  const error = err instanceof Error ? err : new Error('Connection failed');
319
+ hasConnectedRef.current = false;
320
+ isConnectingRef.current = false;
321
+ if (!isMountedRef.current) return;
319
322
  setError(error);
320
323
  setClient(null);
321
324
  setIsConnected(false);
322
325
  setConnectionTime(null);
323
- hasConnectedRef.current = false;
324
- isConnectingRef.current = false;
325
326
 
326
327
  const isAuthError = error.message.includes('token') ||
327
328
  error.message.includes('auth') ||
@@ -363,7 +364,9 @@ function CentrifugoProviderInner({
363
364
  }
364
365
 
365
366
  reconnectTimeoutRef.current = setTimeout(() => {
366
- connectRef.current?.();
367
+ if (isMountedRef.current) {
368
+ connectRef.current?.();
369
+ }
367
370
  }, delay);
368
371
  } else {
369
372
  // Max attempts reached - stop reconnecting
@@ -372,7 +375,10 @@ function CentrifugoProviderInner({
372
375
  }
373
376
  }
374
377
  } finally {
375
- setIsConnecting(false);
378
+ isConnectingRef.current = false;
379
+ if (isMountedRef.current) {
380
+ setIsConnecting(false);
381
+ }
376
382
  }
377
383
  }, [wsUrl, centrifugoToken, user, logger, isConnecting, isConnected, getReconnectDelay, onTokenRefresh]);
378
384