diff options
author | Christian Kraus <hanzi@hanzi.cc> | 2020-01-18 00:11:16 +0100 |
---|---|---|
committer | Christian Kraus <hanzi@hanzi.cc> | 2020-01-18 00:11:16 +0100 |
commit | 8fadc6add639e1bfad6d49368c8f2300908de2de (patch) | |
tree | b6947d37aa69a4cd46ec5746ce98e85301534a6c | |
parent | a38a728a8ce3a97b24248af40b2e3d3edb60620c (diff) |
Prevent bogus updates of selected contact
Before, when creating a new contact the previously
selected contact would still be the 'localContact'.
That happened because the 'contact' watcher would be
called twice (once with the new, once with the old
contact).
Adding a check whether the selected contact has actually
changed remedies that.
Signed-off-by: Christian Kraus <hanzi@hanzi.cc>
-rw-r--r-- | src/components/ContactDetails.vue | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/ContactDetails.vue b/src/components/ContactDetails.vue index 1bdcaf16..5ce82a86 100644 --- a/src/components/ContactDetails.vue +++ b/src/components/ContactDetails.vue @@ -401,8 +401,8 @@ export default { }, watch: { - contact: function() { - if (this.contactKey) { + contact: function(newContact, oldContact) { + if (this.contactKey && newContact !== oldContact) { this.selectContact(this.contactKey) } }, |