Skip to content

Commit 04bc513

Browse files
committed
avoid relying on internals for determining initial render
1 parent 9394d97 commit 04bc513

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/ItemList.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import Spinner from './Spinner.vue'
2424
import Item from './Item.vue'
2525
import { watchList } from '../store/api'
2626
27+
let isInitialRender = true
28+
2729
export default {
2830
name: 'item-list',
2931
@@ -37,8 +39,7 @@ export default {
3739
},
3840
3941
data () {
40-
const isInitialRender = !this.$root._isMounted
41-
return {
42+
const data = {
4243
loading: false,
4344
transition: 'slide-up',
4445
// if this is the initial render, directly render with the store state
@@ -48,6 +49,8 @@ export default {
4849
displayedPage: isInitialRender ? Number(this.$store.state.route.params.page) || 1 : -1,
4950
displayedItems: isInitialRender ? this.$store.getters.activeItems : []
5051
}
52+
isInitialRender = false
53+
return data
5154
},
5255
5356
computed: {

0 commit comments

Comments
 (0)