Skip to content

Commit 04dc782

Browse files
committed
tweaks
1 parent 9c56cde commit 04dc782

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/components/Item.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
export default {
3131
name: 'news-item',
3232
props: ['item'],
33-
serverCacheKey: ({ item: { id, __lastUpdated } }) => {
34-
console.log(__lastUpdated)
35-
return `${id}::${__lastUpdated}`
33+
serverCacheKey: props => {
34+
return `${props.item.id}::${props.item.__lastUpdated}`
3635
}
3736
}
3837
</script>

src/store/api.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ function fetch (child) {
5050
return new Promise((resolve, reject) => {
5151
api.child(child).once('value', snapshot => {
5252
const val = snapshot.val()
53+
// mark the timestamp when this item is cached
5354
val.__lastUpdated = Date.now()
5455
cache && cache.set(child, val)
5556
resolve(val)

src/store/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const store = new Vuex.Store({
2121

2222
actions: {
2323
// ensure data for rendering given list type
24-
FETCH_LIST_DATA: ({ commit, dispatch, state, getters }, { type }) => {
24+
FETCH_LIST_DATA: ({ commit, dispatch, state }, { type }) => {
2525
commit('SET_ACTIVE_TYPE', { type })
2626
return fetchIdsByType(type)
2727
.then(ids => commit('SET_LIST', { type, ids }))

0 commit comments

Comments
 (0)