chore: Upgrade flow (#1854)

* wip: upgrade flow

* chore: More sealed props improvements

* Final fixes
This commit is contained in:
Tom Moor
2021-01-29 21:36:09 -08:00
committed by GitHub
parent ce2b246e60
commit 32f0589190
38 changed files with 191 additions and 96 deletions

View File

@@ -11,7 +11,7 @@ export default class BaseModel {
this.store = store;
}
save = async (params: ?Object) => {
save = async (params: Object = {}) => {
this.isSaving = true;
try {

View File

@@ -142,7 +142,7 @@ export default class Document extends BaseModel {
};
@action
updateFromJson = (data) => {
updateFromJson = (data: Object) => {
set(this, data);
};
@@ -150,7 +150,7 @@ export default class Document extends BaseModel {
return this.store.archive(this);
};
restore = (options) => {
restore = (options: { revisionId?: string, collectionId?: string }) => {
return this.store.restore(this, options);
};
@@ -233,7 +233,7 @@ export default class Document extends BaseModel {
};
@action
save = async (options: SaveOptions) => {
save = async (options: SaveOptions = {}) => {
if (this.isSaving) return this;
const isCreating = !this.id;
@@ -246,7 +246,9 @@ export default class Document extends BaseModel {
collectionId: this.collectionId,
title: this.title,
text: this.text,
...options,
publish: options.publish,
done: options.done,
autosave: options.autosave,
});
}
@@ -257,7 +259,9 @@ export default class Document extends BaseModel {
text: this.text,
templateId: this.templateId,
lastRevision: options.lastRevision,
...options,
publish: options.publish,
done: options.done,
autosave: options.autosave,
});
}