Skip to content

Commit

Permalink
refactor ReferencedEntitySelect: remove selected watcher because of a…
Browse files Browse the repository at this point in the history
… race condition and result of duplications, replace activated with mounted, so references can load again after save
  • Loading branch information
TeodoraPavlova committed Apr 4, 2024
1 parent 3620404 commit 45d2dbd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/Entity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
},
{
name: "Bulk Add (copy Attributes)",
component: shallowRef(EntityBulkAdd),
component: EntityBulkAdd,
icon: "add_circle",
tooltip: "Copy over entity attributes to a new entities"
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/EntityBulkAdd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export default {
},
computed: {
entityFormComponentsCountRange() {
return [...Array(this.entityFormComponentCount).keys()]
return [...Array(this.entityFormComponentCount).keys()];
},
},
methods: {
async saveAll() {
const promises = Object.entries(this.$refs)
.filter(x => x[0].startsWith("entity-form-"))
.map(x => x[1][0].createEntity());
await Promise.all(promises)
await Promise.all(promises);
},
addEntityForm() {
++this.entityFormComponentCount;
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/inputs/ReferencedEntitySelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
currentEntitySlug: this.$route.params.entitySlug,
}
},
activated() {
mounted() {
this.getSelected();
},
computed: {
Expand Down Expand Up @@ -134,10 +134,6 @@ export default {
modelValue() {
this.getSelected();
},
selected: {
handler: "getSelected",
immediate: true
}
}
};
</script>

0 comments on commit 45d2dbd

Please sign in to comment.