feat: move from life cycle to data or watcher

- remove from created / mounted
- initialize component services in data
- use immediate watcher where appropriate
- deep watch for route changes
This commit is contained in:
Dominik Pschenitschni 2021-09-08 11:59:38 +02:00 committed by kolaente
parent ebeca48be4
commit f51371bbe0
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
59 changed files with 246 additions and 376 deletions

View file

@ -134,12 +134,12 @@ export default {
data() {
return {
relatedTasks: {},
taskService: TaskService,
taskService: new TaskService(),
foundTasks: [],
relationKinds: relationKinds,
newTaskRelationTask: TaskModel,
newTaskRelationTask: new TaskModel(),
newTaskRelationKind: 'related',
taskRelationService: TaskRelationService,
taskRelationService: new TaskRelationService(),
showDeleteModal: false,
relationToDelete: {},
saved: false,
@ -171,19 +171,14 @@ export default {
default: true,
},
},
created() {
this.taskService = new TaskService()
this.taskRelationService = new TaskRelationService()
this.newTaskRelationTask = new TaskModel()
},
watch: {
initialRelatedTasks(newVal) {
this.relatedTasks = newVal
initialRelatedTasks: {
handler(value) {
this.relatedTasks = value
},
immediate: true,
},
},
mounted() {
this.relatedTasks = this.initialRelatedTasks
},
computed: {
showCreate() {
return Object.keys(this.relatedTasks).length === 0 || this.showNewRelationForm