File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -177,6 +177,9 @@ class Chart<
177
177
if ( ! layout ) return ;
178
178
const { componentsPosition } = this ;
179
179
const componentPosition = { component, layout } ;
180
+ // 清除已经卸载的component
181
+ this . removeComponentsPositionCache ( ) ;
182
+
180
183
const existIndex = findIndex ( componentsPosition , ( item ) => {
181
184
return item . component === component ;
182
185
} ) ;
@@ -199,6 +202,17 @@ class Chart<
199
202
this . updateCoordLayout ( layout ) ;
200
203
}
201
204
205
+ removeComponentsPositionCache ( ) {
206
+ if ( ! this . componentsPosition ?. length ) return ;
207
+
208
+ for ( let i = this . componentsPosition . length ; i > - 1 ; i -- ) {
209
+ const item = this . componentsPosition [ i ] ;
210
+ if ( item && item . component && item . component . destroyed ) {
211
+ this . componentsPosition . splice ( i , 1 )
212
+ }
213
+ }
214
+ }
215
+
202
216
getGeometrys ( ) {
203
217
// @ts -ignore
204
218
const { children } = this . children ;
You can’t perform that action at this time.
0 commit comments