From e9b6e0e2b74ac4f9c8558c3329c70eee1c869abc Mon Sep 17 00:00:00 2001 From: taehoon Date: Mon, 24 Jun 2019 05:19:43 -0400 Subject: [PATCH] refetch favs and repeats when stats are changed --- src/components/status/status.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/status/status.js b/src/components/status/status.js index 4b3499cd..6f83dbe0 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -402,6 +402,9 @@ const Status = { setMedia () { const attachments = this.attachmentSize === 'hide' ? this.status.attachments : this.galleryAttachments return () => this.$store.dispatch('setMedia', attachments) + }, + refetchFavsAndRepeats () { + this.$store.dispatch('fetchFavsAndRepeats', this.status.id) } }, watch: { @@ -419,6 +422,16 @@ const Status = { window.scrollBy(0, rect.bottom - window.innerHeight + 50) } } + }, + 'status.repeat_num': function (num) { + if (this.isFocused && this.statusFromGlobalRepository.rebloggedBy && this.statusFromGlobalRepository.rebloggedBy.length !== num) { + this.refetchFavsAndRepeats() + } + }, + 'status.fave_num': function (num) { + if (this.isFocused && this.statusFromGlobalRepository.favoritedBy && this.statusFromGlobalRepository.favoritedBy.length !== num) { + this.refetchFavsAndRepeats() + } } }, filters: {