Merge master

This commit is contained in:
Tom Moor
2017-09-13 19:18:49 -07:00
27 changed files with 581 additions and 144 deletions

View File

@ -99,7 +99,7 @@ class Collection extends BaseModel {
return false;
};
updateData(data: Object = {}) {
@action updateData(data: Object = {}) {
this.data = data;
extendObservable(this, data);
}
@ -113,6 +113,17 @@ class Collection extends BaseModel {
this.on('documents.delete', (data: { collectionId: string }) => {
if (data.collectionId === this.id) this.fetch();
});
this.on(
'collections.update',
(data: { id: string, collection: Collection }) => {
// FIXME: calling this.updateData won't update the
// UI. Some mobx issue
if (data.id === this.id) this.fetch();
}
);
this.on('documents.move', (data: { collectionId: string }) => {
if (data.collectionId === this.id) this.fetch();
});
}
}