@@ -155,7 +155,7 @@ async function connect () {
155
155
156
156
// Update tree (tags)
157
157
if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === id ) ) {
158
- sendComponentTreeData ( appRecord , id , ctx . currentAppRecord . componentFilter , 0 , ctx )
158
+ sendComponentTreeData ( appRecord , id , appRecord . componentFilter , 0 , ctx )
159
159
}
160
160
} catch ( e ) {
161
161
if ( process . env . NODE_ENV !== 'production' ) {
@@ -167,21 +167,20 @@ async function connect () {
167
167
hook . on ( HookEvents . COMPONENT_ADDED , async ( app , uid , parentUid , component ) => {
168
168
try {
169
169
const id = await getComponentId ( app , uid , ctx )
170
+ const appRecord = await getAppRecord ( app , ctx )
170
171
if ( component ) {
171
172
if ( component . __VUE_DEVTOOLS_UID__ == null ) {
172
173
component . __VUE_DEVTOOLS_UID__ = id
173
174
}
174
- if ( ! ctx . currentAppRecord . instanceMap . has ( id ) ) {
175
- ctx . currentAppRecord . instanceMap . set ( id , component )
175
+ if ( ! appRecord . instanceMap . has ( id ) ) {
176
+ appRecord . instanceMap . set ( id , component )
176
177
}
177
178
}
178
179
179
- const appRecord = await getAppRecord ( app , ctx )
180
-
181
180
const parentId = await getComponentId ( app , parentUid , ctx )
182
181
if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === parentId ) ) {
183
182
requestAnimationFrame ( ( ) => {
184
- sendComponentTreeData ( appRecord , parentId , ctx . currentAppRecord . componentFilter , null , ctx )
183
+ sendComponentTreeData ( appRecord , parentId , appRecord . componentFilter , null , ctx )
185
184
} )
186
185
}
187
186
@@ -196,24 +195,31 @@ async function connect () {
196
195
} )
197
196
198
197
hook . on ( HookEvents . COMPONENT_REMOVED , async ( app , uid , parentUid , component ) => {
199
- const parentId = await getComponentId ( app , parentUid , ctx )
200
- if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === parentId ) ) {
201
- requestAnimationFrame ( async ( ) => {
202
- try {
203
- sendComponentTreeData ( await getAppRecord ( app , ctx ) , parentId , ctx . currentAppRecord . componentFilter , null , ctx )
204
- } catch ( e ) {
205
- if ( process . env . NODE_ENV !== 'production' ) {
206
- console . error ( e )
198
+ try {
199
+ const appRecord = await getAppRecord ( app , ctx )
200
+ const parentId = await getComponentId ( app , parentUid , ctx )
201
+ if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === parentId ) ) {
202
+ requestAnimationFrame ( async ( ) => {
203
+ try {
204
+ sendComponentTreeData ( await getAppRecord ( app , ctx ) , parentId , appRecord . componentFilter , null , ctx )
205
+ } catch ( e ) {
206
+ if ( process . env . NODE_ENV !== 'production' ) {
207
+ console . error ( e )
208
+ }
207
209
}
208
- }
209
- } )
210
- }
210
+ } )
211
+ }
211
212
212
- const id = await getComponentId ( app , uid , ctx )
213
- if ( isSubscribed ( BridgeSubscriptions . SELECTED_COMPONENT_DATA , sub => sub . payload . instanceId === id ) ) {
214
- sendEmptyComponentData ( id , ctx )
213
+ const id = await getComponentId ( app , uid , ctx )
214
+ if ( isSubscribed ( BridgeSubscriptions . SELECTED_COMPONENT_DATA , sub => sub . payload . instanceId === id ) ) {
215
+ sendEmptyComponentData ( id , ctx )
216
+ }
217
+ appRecord . instanceMap . delete ( id )
218
+ } catch ( e ) {
219
+ if ( process . env . NODE_ENV !== 'production' ) {
220
+ console . error ( e )
221
+ }
215
222
}
216
- ctx . currentAppRecord . instanceMap . delete ( id )
217
223
} )
218
224
219
225
ctx . bridge . on ( BridgeEvents . TO_BACK_COMPONENT_EDIT_STATE , ( { instanceId, dotPath, type, value, newKey, remove } ) => {
0 commit comments