@lark-apaas/client-toolkit 1.2.10-alpha.34 → 1.2.10-alpha.36

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.
@@ -5,6 +5,11 @@
5
5
  * for live component prop modification in the inspector.
6
6
  *
7
7
  * Must execute before React's module-level code runs.
8
+ *
9
+ * When react-refresh-runtime runs first (as an rspack runtime module),
10
+ * it may create __REACT_DEVTOOLS_GLOBAL_HOOK__ with an inject() that
11
+ * doesn't populate the renderers Map. We patch the existing hook to
12
+ * ensure renderers are always tracked.
8
13
  */
9
14
  export {};
10
15
  declare global {
@@ -1,4 +1,13 @@
1
- if ('undefined' != typeof window && !window.__REACT_DEVTOOLS_GLOBAL_HOOK__) window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
1
+ if ('undefined' != typeof window) if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
2
+ const hook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
3
+ if (!(hook.renderers instanceof Map)) hook.renderers = new Map();
4
+ const originalInject = 'function' == typeof hook.inject ? hook.inject.bind(hook) : null;
5
+ hook.inject = function(renderer) {
6
+ const id = originalInject ? originalInject(renderer) : hook.renderers.size + 1;
7
+ if (null != id && !hook.renderers.has(id)) hook.renderers.set(id, renderer);
8
+ return id;
9
+ };
10
+ } else window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
2
11
  renderers: new Map(),
3
12
  supportsFiber: true,
4
13
  inject (renderer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/client-toolkit",
3
- "version": "1.2.10-alpha.34",
3
+ "version": "1.2.10-alpha.36",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -96,7 +96,7 @@
96
96
  "@data-loom/js": "0.4.6",
97
97
  "@lark-apaas/auth-sdk": "^0.1.0",
98
98
  "@lark-apaas/client-capability": "^0.1.4",
99
- "@lark-apaas/miaoda-inspector": "1.0.14-alpha.17",
99
+ "@lark-apaas/miaoda-inspector": "1.0.14-alpha.18",
100
100
  "@lark-apaas/observable-web": "^1.0.1",
101
101
  "@radix-ui/react-avatar": "^1.1.10",
102
102
  "@radix-ui/react-popover": "^1.1.15",