Skip to content

Commit f248c8e

Browse files
committed
Merge branch 'mweststrate-patch-1'
2 parents 27250a2 + 4383498 commit f248c8e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

frameworks/keyed/react-mobX/src/Store.es6.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
var {observer} = require("mobx-react");
43
var {observable, computed, action} = require ("mobx");
54

65
function _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+
}

0 commit comments

Comments
 (0)