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 @@ -2135,6 +2135,7 @@ export class GridStack {
21352135 this . _updateContainerHeight ( ) ;
21362136 this . engine . addedNodes . push ( node ) ; // @ts -ignore
21372137 this . _triggerAddEvent ( ) ; // @ts -ignore
2138+ this . engine . removeNodeFromLayoutCache ( node ) ;
21382139 this . _triggerChangeEvent ( ) ;
21392140
21402141 this . engine . endUpdate ( ) ;
You can’t perform that action at this time.
0 commit comments