File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed 
frameworks/keyed/react-mobX/src Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 11'use strict' ; 
22
3- var  { observer}  =  require ( "mobx-react" ) ; 
43var  { observable,  computed,  action}  =  require  ( "mobx" ) ; 
54
65function  _random ( max )  { 
@@ -43,21 +42,21 @@ export class Store {
4342            data . push ( row ( this ,  adjectives [ _random ( adjectives . length ) ]  +  " "  +  colours [ _random ( colours . length ) ]  +  " "  +  nouns [ _random ( nouns . length ) ]  ) ) ; 
4443        return  data ; 
4544    } 
45+ 
4646    @action  updateData ( mod  =  10 )  { 
4747        for  ( let  i = 0 ; i < this . data . length ; i += 10 )  { 
4848            this . data [ i ] . label  =  this . data [ i ] . label  +  ' !!!' ; 
4949        } 
5050    } 
5151    @action  delete ( row )  { 
52-         const  idx  =  this . data . indexOf ( row ) ; 
53-         this . data . splice ( idx ,  1 ) ; 
52+         this . data . remove ( row ) ; 
5453    } 
5554    @action  run ( )  { 
56-         this . data   =   this . buildData ( ) ; 
55+         this . data . replace ( this . buildData ( ) ) ; 
5756        this . selected  =  undefined ; 
5857    } 
5958    @action  add ( )  { 
60-         this . data   =   this . data . concat ( this . buildData ( 1000 ) ) ; 
59+         this . data . spliceWithArray ( this . data . length ,   0 ,   this . buildData ( 1000 ) ) ; 
6160    } 
6261    @action  update ( )  { 
6362        this . updateData ( ) ; 
@@ -66,11 +65,11 @@ export class Store {
6665        this . selected  =  row ; 
6766    } 
6867    @action  runLots ( )  { 
69-         this . data   =   this . buildData ( 10000 ) ; 
68+         this . data . replace ( this . buildData ( 10000 ) ) ; 
7069        this . selected  =  undefined ; 
7170    } 
7271    @action  clear ( )  { 
73-         this . data   =   [ ] ; 
72+         this . data . clear ( ) ; 
7473        this . selected  =  undefined ; 
7574    } 
7675    @action  swapRows ( )  { 
@@ -80,4 +79,4 @@ export class Store {
8079    		this . data [ 998 ]  =  a ; 
8180    	} 
8281    } 
83- } 
82+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments