@chromahq/react 1.0.40 → 1.0.41

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,26 +5,27 @@ const BRIDGE_ENABLE_LOGS = true;
5
5
  const CONFIG = {
6
6
  RETRY_AFTER: 1e3,
7
7
  MAX_RETRIES: 10,
8
- PING_INTERVAL: 5e3,
9
- // Check every 5s (reduced frequency to avoid false positives during heavy operations)
8
+ PING_INTERVAL: 15e3,
9
+ // Check every 15s (tolerant of long operations)
10
10
  MAX_RETRY_COOLDOWN: 3e4,
11
- DEFAULT_TIMEOUT: 3e4,
12
- // Increased from 20s to 30s for slow operations
11
+ DEFAULT_TIMEOUT: 6e4,
12
+ // 60s default for slow operations
13
13
  MAX_RETRY_DELAY: 3e4,
14
- PING_TIMEOUT: 1e4,
15
- // Give SW 10s to respond (handles busy periods like large storage reads)
14
+ PING_TIMEOUT: 2e4,
15
+ // Give SW 20s to respond to ping
16
16
  ERROR_CHECK_INTERVAL: 100,
17
17
  MAX_ERROR_CHECKS: 10,
18
18
  CONSECUTIVE_FAILURE_THRESHOLD: 5,
19
- // Require 5 consecutive failures (25s total) before reconnecting
19
+ // Require 5 consecutive failures (75s total) before reconnecting
20
20
  RECONNECT_DELAY: 100,
21
21
  PORT_NAME: "chroma-bridge",
22
22
  // Service worker restart retry settings (indefinite retries)
23
23
  SW_RESTART_RETRY_DELAY: 500,
24
24
  SW_RESTART_MAX_DELAY: 5e3,
25
25
  // Threshold for counting timeouts toward reconnection (only count fast timeouts as failures)
26
- TIMEOUT_FAILURE_THRESHOLD_MS: 15e3
27
- // Only count timeouts < 15s as potential SW issues
26
+ // Requests with timeout > this value are considered intentional long operations
27
+ TIMEOUT_FAILURE_THRESHOLD_MS: 3e4
28
+ // Only count timeouts < 30s as potential SW issues
28
29
  };
29
30
  const calculateBackoffDelay = (attempt, baseDelay, maxDelay) => Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
30
31
  const clearTimeoutSafe = (ref) => {
@@ -559,7 +560,7 @@ const BridgeProvider = ({
559
560
  if (BRIDGE_ENABLE_LOGS) {
560
561
  console.log("[Bridge] Grace period ended, timeout monitoring active");
561
562
  }
562
- }, 3e3);
563
+ }, 1e4);
563
564
  eventListenersRef.current.get("bridge:connected")?.forEach((handler) => {
564
565
  try {
565
566
  handler({ timestamp: Date.now() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromahq/react",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "React bindings for the Chroma Chrome extension framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",