chayns-api 3.4.1 → 3.4.2

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.
@@ -7,7 +7,6 @@ exports.loadModule = exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const ERROR_CACHE_TIME = 60000;
10
- const errorResetTimeouts = new Set();
11
10
  const normalizeUrl = url => {
12
11
  try {
13
12
  return new URL(url).toString();
@@ -17,20 +16,21 @@ const normalizeUrl = url => {
17
16
  };
18
17
  const resetAfterCacheTime = (scope, module, url) => {
19
18
  const key = `${scope}\n${module}\n${url}`;
19
+ if (!globalThis.moduleFederationScopes.errorResetTimeouts) {
20
+ globalThis.moduleFederationScopes.errorResetTimeouts = new Set();
21
+ }
22
+ const errorResetTimeouts = globalThis.moduleFederationScopes.errorResetTimeouts;
20
23
  if (errorResetTimeouts.has(key)) {
21
24
  return;
22
25
  }
23
26
  errorResetTimeouts.add(key);
24
27
  setTimeout(() => {
25
- var _componentMap$scope;
26
28
  const {
27
- registeredScopes,
28
- componentMap
29
+ registeredScopes
29
30
  } = globalThis.moduleFederationScopes;
30
31
  if (registeredScopes[scope] === url) {
31
32
  registeredScopes[scope] = '';
32
33
  }
33
- (_componentMap$scope = componentMap[scope]) === null || _componentMap$scope === void 0 || delete _componentMap$scope[module];
34
34
  errorResetTimeouts.delete(key);
35
35
  }, ERROR_CACHE_TIME);
36
36
  };
@@ -65,7 +65,8 @@ const initModuleFederationSharing = ({
65
65
  globalThis.moduleFederationScopes = {
66
66
  registeredScopes: {},
67
67
  moduleMap: {},
68
- componentMap: {}
68
+ componentMap: {},
69
+ errorResetTimeouts: new Set()
69
70
  };
70
71
  };
71
72
  exports.initModuleFederationSharing = initModuleFederationSharing;
@@ -3,7 +3,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import React from "react";
5
5
  const ERROR_CACHE_TIME = 60000;
6
- const errorResetTimeouts = new Set();
7
6
  const normalizeUrl = url => {
8
7
  try {
9
8
  return new URL(url).toString();
@@ -13,20 +12,21 @@ const normalizeUrl = url => {
13
12
  };
14
13
  const resetAfterCacheTime = (scope, module, url) => {
15
14
  const key = `${scope}\n${module}\n${url}`;
15
+ if (!globalThis.moduleFederationScopes.errorResetTimeouts) {
16
+ globalThis.moduleFederationScopes.errorResetTimeouts = new Set();
17
+ }
18
+ const errorResetTimeouts = globalThis.moduleFederationScopes.errorResetTimeouts;
16
19
  if (errorResetTimeouts.has(key)) {
17
20
  return;
18
21
  }
19
22
  errorResetTimeouts.add(key);
20
23
  setTimeout(() => {
21
- var _componentMap$scope;
22
24
  const {
23
- registeredScopes,
24
- componentMap
25
+ registeredScopes
25
26
  } = globalThis.moduleFederationScopes;
26
27
  if (registeredScopes[scope] === url) {
27
28
  registeredScopes[scope] = '';
28
29
  }
29
- (_componentMap$scope = componentMap[scope]) === null || _componentMap$scope === void 0 || delete _componentMap$scope[module];
30
30
  errorResetTimeouts.delete(key);
31
31
  }, ERROR_CACHE_TIME);
32
32
  };
@@ -58,6 +58,7 @@ export const initModuleFederationSharing = ({
58
58
  globalThis.moduleFederationScopes = {
59
59
  registeredScopes: {},
60
60
  moduleMap: {},
61
- componentMap: {}
61
+ componentMap: {},
62
+ errorResetTimeouts: new Set()
62
63
  };
63
64
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "3.4.1",
3
+ "version": "3.4.2",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",