From e8d7abbf33417c843716d7cff1f50e92447a5341 Mon Sep 17 00:00:00 2001 From: Jeff Sagal Date: Mon, 18 Oct 2021 13:35:36 -0700 Subject: [PATCH] refactor: use an immediate watcher instead of created hook for reduce (#1523) --- src/components/Select.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/Select.vue b/src/components/Select.vue index be11e98..47f810d 100644 --- a/src/components/Select.vue +++ b/src/components/Select.vue @@ -932,10 +932,13 @@ export default { * Make sure to update internal * value if prop changes outside */ - value(val) { - if (this.isTrackingValues) { - this.setInternalValueFromOptions(val) - } + value: { + immediate: true, + handler(val) { + if (this.isTrackingValues) { + this.setInternalValueFromOptions(val) + } + }, }, /** @@ -955,10 +958,6 @@ export default { created() { this.mutableLoading = this.loading - if (typeof this.value !== 'undefined' && this.isTrackingValues) { - this.setInternalValueFromOptions(this.value) - } - this.$on('option:created', this.pushTag) },