Merge remote-tracking branch 'origin/master' into distinct-shouts-and-follows

This commit is contained in:
Grzegorz Leoniec 2019-03-06 18:46:16 +01:00
commit c71f6fb07c
No known key found for this signature in database
GPG Key ID: 3AA43686D4EB1377
2 changed files with 29 additions and 19 deletions

View File

@ -5,7 +5,7 @@
tag="span"
>
<count-to
:start-val="startVal"
:start-val="lastEndVal || startVal"
:end-val="endVal"
:duration="duration"
:autoplay="autoplay"
@ -27,6 +27,24 @@ export default {
duration: { type: Number, default: 3000 },
autoplay: { type: Boolean, default: true },
separator: { type: String, default: '.' }
},
data() {
return {
lastEndVal: null,
isReady: false
}
},
watch: {
endVal(endVal) {
if (this.isReady && this.startVal === 0 && !this.lastEndVal) {
this.lastEndVal = this.endVal
}
}
},
mounted() {
setTimeout(() => {
this.isReady = true
}, 500)
}
}
</script>

View File

@ -13,7 +13,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countUsers || 0"
:start-val="0"
:end-val="statistics.countUsers || 0"
/>
</no-ssr>
@ -30,7 +30,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countPosts || 0"
:start-val="0"
:end-val="statistics.countPosts || 0"
/>
</no-ssr>
@ -47,7 +47,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countComments || 0"
:start-val="0"
:end-val="statistics.countComments || 0"
/>
</no-ssr>
@ -64,7 +64,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countNotifications || 0"
:start-val="0"
:end-val="statistics.countNotifications || 0"
/>
</no-ssr>
@ -81,7 +81,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countOrganizations || 0"
:start-val="0"
:end-val="statistics.countOrganizations || 0"
/>
</no-ssr>
@ -98,7 +98,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countProjects || 0"
:start-val="0"
:end-val="statistics.countProjects || 0"
/>
</no-ssr>
@ -115,7 +115,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countInvites || 0"
:start-val="0"
:end-val="statistics.countInvites || 0"
/>
</no-ssr>
@ -132,7 +132,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countFollows || 0"
:start-val="0"
:end-val="statistics.countFollows || 0"
/>
</no-ssr>
@ -149,7 +149,7 @@
>
<no-ssr slot="count">
<hc-count-to
:start-val="statisticsBefore.countShouts || 0"
:start-val="0"
:end-val="statistics.countShouts || 0"
/>
</no-ssr>
@ -172,8 +172,7 @@ export default {
},
data() {
return {
statistics: {},
statisticsBefore: {}
statistics: {}
}
},
computed: {
@ -181,13 +180,6 @@ export default {
return process.client
}
},
watch: {
statistics(newVal) {
setTimeout(() => {
this.statisticsBefore = { ...this.statistics }
}, 3000)
}
},
mounted() {
this.$apollo.queries.statistics.startPolling(5000)
},