Fix animation not being performed on new reaction (#5345)

* Fix animation not being performed on new reaction

* Clean up
This commit is contained in:
Aya Morisawa 2019-08-29 05:11:26 +09:00 committed by syuilo
parent 2d6d9f30e1
commit be33581642
2 changed files with 13 additions and 1 deletions

View file

@ -26,6 +26,10 @@ export default Vue.extend({
type: Number, type: Number,
required: true, required: true,
}, },
isInitial: {
type: Boolean,
required: true,
},
note: { note: {
type: Object, type: Object,
required: true, required: true,
@ -41,6 +45,9 @@ export default Vue.extend({
return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId; return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId;
}, },
}, },
mounted() {
if (!this.isInitial) this.anime();
},
watch: { watch: {
count() { count() {
this.anime(); this.anime();

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="mk-reactions-viewer" :class="{ isMe }"> <div class="mk-reactions-viewer" :class="{ isMe }">
<x-reaction v-for="(count, reaction) in reactions" :reaction="reaction" :count="count" :note="note" :key="reaction"/> <x-reaction v-for="(count, reaction) in reactions" :reaction="reaction" :count="count" :is-initial="initialReactions.has(reaction)" :note="note" :key="reaction"/>
</div> </div>
</template> </template>
@ -12,6 +12,11 @@ export default Vue.extend({
components: { components: {
XReaction XReaction
}, },
data() {
return {
initialReactions: new Set(Object.keys(this.note.reactions))
};
},
props: { props: {
note: { note: {
type: Object, type: Object,