akeyless-client-commons 1.0.173 → 1.0.174

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.
@@ -25,7 +25,7 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
25
25
  }
26
26
 
27
27
  declare const useDocumentTitle: (title: string) => any;
28
- declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string) => void;
28
+ declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string, cleanupForConfigChange?: boolean) => void;
29
29
  declare const useSetUserCountry: (setUserCountry: Dispatch<SetStateAction<CountryOptions>>, changLang: (lang: string) => void) => any;
30
30
 
31
31
  declare function useSafeEffect(callback: () => void, dependencies: any[], error_message?: string): void;
@@ -25,7 +25,7 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
25
25
  }
26
26
 
27
27
  declare const useDocumentTitle: (title: string) => any;
28
- declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string) => void;
28
+ declare const useSnapshotBulk: (configs: OnSnapshotConfig[], label?: string, cleanupForConfigChange?: boolean) => void;
29
29
  declare const useSetUserCountry: (setUserCountry: Dispatch<SetStateAction<CountryOptions>>, changLang: (lang: string) => void) => any;
30
30
 
31
31
  declare function useSafeEffect(callback: () => void, dependencies: any[], error_message?: string): void;
@@ -528,6 +528,7 @@ var useDocumentTitle = function(title) {
528
528
  return null;
529
529
  };
530
530
  var useSnapshotBulk = function(configs, label) {
531
+ var cleanupForConfigChange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
531
532
  var snapshotsFirstTime = (0, import_react3.useRef)([]);
532
533
  var unsubscribeFunctions = (0, import_react3.useRef)([]);
533
534
  useDeepCompareEffect(function() {
@@ -544,9 +545,20 @@ var useSnapshotBulk = function(configs, label) {
544
545
  })).then(function() {
545
546
  console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
546
547
  });
548
+ if (cleanupForConfigChange) {
549
+ return function() {
550
+ unsubscribeFunctions.current.forEach(function(unsubscribe) {
551
+ if (unsubscribe) {
552
+ unsubscribe();
553
+ }
554
+ });
555
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
556
+ };
557
+ }
547
558
  }, [
548
559
  configs,
549
- label
560
+ label,
561
+ cleanupForConfigChange
550
562
  ]);
551
563
  (0, import_react3.useEffect)(function() {
552
564
  return function() {
@@ -440,6 +440,7 @@ var useDocumentTitle = function(title) {
440
440
  return null;
441
441
  };
442
442
  var useSnapshotBulk = function(configs, label) {
443
+ var cleanupForConfigChange = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
443
444
  var snapshotsFirstTime = useRef2([]);
444
445
  var unsubscribeFunctions = useRef2([]);
445
446
  useDeepCompareEffect(function() {
@@ -456,9 +457,20 @@ var useSnapshotBulk = function(configs, label) {
456
457
  })).then(function() {
457
458
  console.log("==> ".concat(label || "Custom snapshots", " ended. It took ").concat((performance.now() - start).toFixed(2), " ms"));
458
459
  });
460
+ if (cleanupForConfigChange) {
461
+ return function() {
462
+ unsubscribeFunctions.current.forEach(function(unsubscribe) {
463
+ if (unsubscribe) {
464
+ unsubscribe();
465
+ }
466
+ });
467
+ console.log("==> ".concat(label || "Custom snapshots", " unsubscribed"));
468
+ };
469
+ }
459
470
  }, [
460
471
  configs,
461
- label
472
+ label,
473
+ cleanupForConfigChange
462
474
  ]);
463
475
  useEffect2(function() {
464
476
  return function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.0.173",
3
+ "version": "1.0.174",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",