File tree 1 file changed +21
-2
lines changed
packages/runtime-core/src
1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ interface DevtoolsHook {
28
28
once : ( event : string , handler : Function ) => void
29
29
off : ( event : string , handler : Function ) => void
30
30
appRecords : AppRecord [ ]
31
+ _buffer : any [ ] [ ]
31
32
}
32
33
33
34
export let devtools : DevtoolsHook
@@ -101,8 +102,26 @@ export const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook(
101
102
export const devtoolsComponentUpdated =
102
103
/*#__PURE__*/ createDevtoolsComponentHook ( DevtoolsHooks . COMPONENT_UPDATED )
103
104
104
- export const devtoolsComponentRemoved =
105
- /*#__PURE__*/ createDevtoolsComponentHook ( DevtoolsHooks . COMPONENT_REMOVED )
105
+ const _devtoolsComponentRemoved = /*#__PURE__*/ createDevtoolsComponentHook (
106
+ DevtoolsHooks . COMPONENT_REMOVED
107
+ )
108
+
109
+ export const devtoolsComponentRemoved = (
110
+ component : ComponentInternalInstance
111
+ ) => {
112
+ if ( devtools && devtools . _buffer . length ) {
113
+ let wasBuffered = false
114
+ devtools . _buffer = devtools . _buffer . filter ( item => {
115
+ if ( item . some ( arg => arg === component ) ) {
116
+ wasBuffered = true
117
+ return false
118
+ }
119
+ return true
120
+ } )
121
+ if ( wasBuffered ) return
122
+ }
123
+ _devtoolsComponentRemoved ( component )
124
+ }
106
125
107
126
function createDevtoolsComponentHook ( hook : DevtoolsHooks ) {
108
127
return ( component : ComponentInternalInstance ) => {
You can’t perform that action at this time.
0 commit comments