I have a Vue 3 app and I am seeing inconsistencies in the behaviour of the $emit function.
async updateContact(contact) {
this.$emit("loading", true);
await this.updateCustomerDetails().then((response) => {
console.log(response);
}).catch((error) => {
this.$emit("handleError", error);
});
this.$emit("loading", false);
}
The first call to $emit seems to work as expected but the subsequent two do not and I can't work out why that might be.
To give some more context, this is my structure:
<app-tabs :tabList="tabs" :activeTab="activeTab" @selectTab="updateSelectedTab">
<template v-slot:tabPanel-1>
<customer-details @loading="loading" @handle-error="handleError">
</customer-details>
</template>
</app-tabs>
My customer details component is what should be emitting those events. I've wasted most of my afternoon trying to get to the bottom of this and fear now I am missing something obvious or completely misunderstanding this somewhere along the line.
I have put together a simplified example.