Commit 04bc513d authored by Evan You's avatar Evan You

avoid relying on internals for determining initial render

parent 9394d976
...@@ -24,6 +24,8 @@ import Spinner from './Spinner.vue' ...@@ -24,6 +24,8 @@ import Spinner from './Spinner.vue'
import Item from './Item.vue' import Item from './Item.vue'
import { watchList } from '../store/api' import { watchList } from '../store/api'
let isInitialRender = true
export default { export default {
name: 'item-list', name: 'item-list',
...@@ -37,8 +39,7 @@ export default { ...@@ -37,8 +39,7 @@ export default {
}, },
data () { data () {
const isInitialRender = !this.$root._isMounted const data = {
return {
loading: false, loading: false,
transition: 'slide-up', transition: 'slide-up',
// if this is the initial render, directly render with the store state // if this is the initial render, directly render with the store state
...@@ -48,6 +49,8 @@ export default { ...@@ -48,6 +49,8 @@ export default {
displayedPage: isInitialRender ? Number(this.$store.state.route.params.page) || 1 : -1, displayedPage: isInitialRender ? Number(this.$store.state.route.params.page) || 1 : -1,
displayedItems: isInitialRender ? this.$store.getters.activeItems : [] displayedItems: isInitialRender ? this.$store.getters.activeItems : []
} }
isInitialRender = false
return data
}, },
computed: { computed: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment