From b9cfdf54565066fcd90ea5b3527daa2966dcab71 Mon Sep 17 00:00:00 2001 From: bton Date: Wed, 6 Nov 2024 21:09:06 +0100 Subject: [PATCH] fixed race contidion on ticket view loading --- web/src/views/Ticket.vue | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/web/src/views/Ticket.vue b/web/src/views/Ticket.vue index 63f3515..cbb372c 100644 --- a/web/src/views/Ticket.vue +++ b/web/src/views/Ticket.vue @@ -79,16 +79,6 @@ export default { shipping_voucher_type: null, } }, - watch: { - ticket(val) { - if (this.selected_state == null) { - this.selected_state = val.state; - } - if (this.selected_assignee == null) { - this.selected_assignee = val.assigned_to - } - } - }, computed: { ...mapState(['tickets', 'state_options', 'users']), ...mapGetters(['availableShippingVoucherTypes']), @@ -134,12 +124,14 @@ export default { }, }, mounted() { - this.scheduleAfterInit(() => [this.fetchTicketStates(), this.loadTickets(), this.loadUsers(), - this.fetchShippingVouchers()]); + this.scheduleAfterInit(() => [Promise.all([this.fetchTicketStates(), this.loadTickets(), this.loadUsers(), this.fetchShippingVouchers()]).then(()=>{ + this.selected_state = this.ticket.state; + this.selected_assignee = this.ticket.assigned_to + })]); } }; \ No newline at end of file +