|
2 | 2 | import { isPromise } from "@vue/shared"; |
3 | 3 |
|
4 | 4 | import { Controller } from "./controller"; |
5 | | -import { InternalNameSpace, isServer } from "./env"; |
| 5 | +import { InternalNameSpace } from "./env"; |
6 | 6 | import { createLifeCycle } from "./lifeCycle"; |
7 | 7 | import { traverse, traverseShallow } from "./tools"; |
8 | 8 |
|
@@ -33,56 +33,6 @@ export const checkHasKey = (key: string) => { |
33 | 33 | return key in namespaceMap; |
34 | 34 | }; |
35 | 35 |
|
36 | | -if (__DEV__ && !isServer) { |
37 | | - try { |
38 | | - globalThis["@reactivity-store"] = globalThis["@reactivity-store"] || new WeakMap(); |
39 | | - } catch { |
40 | | - void 0; |
41 | | - } |
42 | | -} |
43 | | - |
44 | | -/** |
45 | | - * @internal |
46 | | - */ |
47 | | -export const setDevController = (controller: Controller, state: any) => { |
48 | | - if (__DEV__ && !isServer) { |
49 | | - if (!globalThis["@reactivity-store"]) return; |
50 | | - try { |
51 | | - const set = (globalThis["@reactivity-store"]?.get?.(state) || new Set()) as Set<Controller>; |
52 | | - |
53 | | - set.add(controller); |
54 | | - |
55 | | - // eslint-disable-next-line @typescript-eslint/ban-ts-comment |
56 | | - // @ts-ignore |
57 | | - set.name = controller._namespace || set?.name; |
58 | | - |
59 | | - globalThis["@reactivity-store"]?.set?.(state, set); |
60 | | - } catch { |
61 | | - void 0; |
62 | | - } |
63 | | - } |
64 | | -}; |
65 | | - |
66 | | -/** |
67 | | - * @internal |
68 | | - */ |
69 | | -export const delDevController = (controller: Controller, state: any) => { |
70 | | - if (__DEV__ && !isServer) { |
71 | | - if (!globalThis["@reactivity-store"]) return; |
72 | | - try { |
73 | | - const set = globalThis["@reactivity-store"]?.get?.(state) as Set<Controller>; |
74 | | - |
75 | | - set?.delete?.(controller); |
76 | | - |
77 | | - if (set.size === 0) { |
78 | | - globalThis["@reactivity-store"]?.delete?.(state); |
79 | | - } |
80 | | - } catch { |
81 | | - void 0; |
82 | | - } |
83 | | - } |
84 | | -}; |
85 | | - |
86 | 36 | // cache state which has connect to devtool |
87 | 37 | const devToolMap: Record<string, any> = {}; |
88 | 38 |
|
@@ -132,14 +82,10 @@ export const connectDevTool = ( |
132 | 82 |
|
133 | 83 | globalDevTools = devTools; |
134 | 84 |
|
135 | | - const existState = devToolMap[name]; |
136 | | - |
137 | 85 | const existController = devController[name]; |
138 | 86 |
|
139 | 87 | if (existController) { |
140 | 88 | existController.stop(); |
141 | | - |
142 | | - delDevController(existController, existState); |
143 | 89 | } |
144 | 90 |
|
145 | 91 | devToolMap[name] = readonlyState; |
@@ -179,8 +125,6 @@ export const connectDevTool = ( |
179 | 125 |
|
180 | 126 | controller.run(); |
181 | 127 |
|
182 | | - setDevController(controller, readonlyState); |
183 | | - |
184 | 128 | const obj = { ...devToolMap }; |
185 | 129 |
|
186 | 130 | devTools.init(obj); |
|
0 commit comments