Skip to content
Snippets Groups Projects
Commit 7c7291c2 authored by permcu's avatar permcu
Browse files

Make objectForm implicitly handle undefined isCreate

depending on the presence of editItem.

For the rationale see comment in change.
parent 0e643a96
No related branches found
No related tags found
1 merge request!1798Make objectForm implicitly handle undefined isCreate
Pipeline #197832 passed with warnings
......@@ -14,6 +14,7 @@ Changed
* Announcements are shown in calendar.
* DialogObjectForm is now slightly wider.
* [Dev] DialogObjectForm now implicitly handles a missing isCreate-prop depending on the presence of editItem.
Fixed
~~~~~
......
......@@ -15,7 +15,7 @@ export default {
isCreate: {
type: Boolean,
required: false,
default: true,
default: undefined,
},
/**
* The graphQL create mutation
......
......@@ -55,6 +55,13 @@ export default {
this.resetModel();
},
resetModel() {
// Handle isCreate undefined, by deciding on the presence of editItem
// This implicit behaviour often makes more sense
// and doing it higher up (in parent) makes parent less flexible.
// Specifically not working anymore with CRUD.
if (!this.isCreate) {
this.isCreate = !this.editItem;
}
this.itemModel = JSON.parse(
JSON.stringify(this.isCreate ? this.defaultItem : this.editItem),
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment