@copart/ops-tool-kit 1.12.16 → 1.12.17

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.
@@ -47,7 +47,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
47
47
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
48
48
 
49
49
  const name$1 = "@copart/ops-tool-kit";
50
- const version$3 = "1.12.16";
50
+ const version$3 = "1.12.17";
51
51
  const main$1 = "dist/ops-tool-kit.js";
52
52
  const style = "dist/ops-tool-kit.css";
53
53
  const files = [
@@ -29495,6 +29495,8 @@ var startTabLeaderCoordinator = function startTabLeaderCoordinator(_ref) {
29495
29495
  console.error('[TabLeaderCoordinator] BroadcastChannel creation failed:', error);
29496
29496
  bc = null;
29497
29497
  }
29498
+ var stopped = false;
29499
+ var pendingElectionTimeout = null;
29498
29500
  var isLeader = false;
29499
29501
  var renewTimer = null;
29500
29502
  var heartbeatTimer = null;
@@ -29540,7 +29542,7 @@ var startTabLeaderCoordinator = function startTabLeaderCoordinator(_ref) {
29540
29542
  });
29541
29543
  };
29542
29544
  var becomeLeader = function becomeLeader() {
29543
- if (isLeader) return;
29545
+ if (isLeader || stopped) return;
29544
29546
  isLeader = true;
29545
29547
  if (bc) {
29546
29548
  try {
@@ -29589,6 +29591,7 @@ var startTabLeaderCoordinator = function startTabLeaderCoordinator(_ref) {
29589
29591
  renewTimer = heartbeatTimer = interactionCheckTimer = null;
29590
29592
  };
29591
29593
  var tryBecomeLeader = function tryBecomeLeader() {
29594
+ if (stopped) return;
29592
29595
  var lock = readLock();
29593
29596
  var expired = !lock || lock.expiresAt <= now();
29594
29597
  if (expired) {
@@ -29632,10 +29635,15 @@ var startTabLeaderCoordinator = function startTabLeaderCoordinator(_ref) {
29632
29635
  window.addEventListener('beforeunload', handleBeforeUnload);
29633
29636
  window.addEventListener('pagehide', handleBeforeUnload);
29634
29637
  electionTimer = setInterval(function () {
29635
- setTimeout(tryBecomeLeader, Math.random() * JITTER_MS);
29638
+ pendingElectionTimeout = setTimeout(tryBecomeLeader, Math.random() * JITTER_MS);
29636
29639
  }, ELECTION_INTERVAL_MS);
29637
29640
  tryBecomeLeader();
29638
29641
  return function () {
29642
+ stopped = true;
29643
+ if (pendingElectionTimeout) {
29644
+ clearTimeout(pendingElectionTimeout);
29645
+ pendingElectionTimeout = null;
29646
+ }
29639
29647
  window.removeEventListener('storage', handleStorage);
29640
29648
  window.removeEventListener('beforeunload', handleBeforeUnload);
29641
29649
  window.removeEventListener('pagehide', handleBeforeUnload);
@@ -30668,7 +30676,6 @@ var AppBar = function AppBar(_ref) {
30668
30676
  };
30669
30677
  }, []);
30670
30678
  React.useEffect(function () {
30671
- console.log('***coreAppConfig', coreAppConfig, coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.disableHeartbeat);
30672
30679
  if (coreAppConfig !== null && coreAppConfig !== void 0 && coreAppConfig.disableHeartbeat) return;
30673
30680
  var heartBeatEnabledStatuses = ((coreAppConfig === null || coreAppConfig === void 0 ? void 0 : coreAppConfig.heartBeatEnabledStatuses) || ['available']).map(function (s) {
30674
30681
  var _s$toLowerCase2;