File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ interface DevtoolsHook {
2828 once : ( event : string , handler : Function ) => void
2929 off : ( event : string , handler : Function ) => void
3030 appRecords : AppRecord [ ]
31+ _buffer : any [ ] [ ]
3132}
3233
3334export let devtools : DevtoolsHook
@@ -101,8 +102,26 @@ export const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook(
101102export const devtoolsComponentUpdated =
102103 /*#__PURE__*/ createDevtoolsComponentHook ( DevtoolsHooks . COMPONENT_UPDATED )
103104
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+ }
106125
107126function createDevtoolsComponentHook ( hook : DevtoolsHooks ) {
108127 return ( component : ComponentInternalInstance ) => {
You can’t perform that action at this time.
0 commit comments