File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -958,6 +958,17 @@ export class GridStackEngine {
958958 return this . _layouts ?. [ column ] ?. findIndex ( l => l . _id === n . _id ) ?? - 1 ;
959959 }
960960
961+ public removeNodeFromLayoutCache ( n : GridStackNode ) {
962+ if ( ! this . _layouts ) {
963+ return ;
964+ }
965+ for ( let i = 0 ; i < this . _layouts . length ; i ++ ) {
966+ let index = this . findCacheLayout ( n , i ) ;
967+ if ( index !== - 1 ) {
968+ this . _layouts [ i ] . splice ( index , 1 ) ;
969+ }
970+ }
971+ }
961972
962973 /** called to remove all internal values but the _id */
963974 public cleanupNode ( node : GridStackNode ) : GridStackEngine {
Original file line number Diff line number Diff line change @@ -2141,6 +2141,7 @@ export class GridStack {
21412141 this . _updateContainerHeight ( ) ;
21422142 this . engine . addedNodes . push ( node ) ; // @ts -ignore
21432143 this . _triggerAddEvent ( ) ; // @ts -ignore
2144+ this . engine . removeNodeFromLayoutCache ( node ) ;
21442145 this . _triggerChangeEvent ( ) ;
21452146
21462147 this . engine . endUpdate ( ) ;
You can’t perform that action at this time.
0 commit comments