Skip to content

Commit 636edad

Browse files
committed
fix caching mismatch by taking timeAgo into account (fix #45)
1 parent 5d96740 commit 636edad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/Item.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,20 @@
2727
</template>
2828

2929
<script>
30+
import { timeAgo } from '../filters'
31+
3032
export default {
3133
name: 'news-item',
3234
props: ['item'],
3335
// https://github.com/vuejs/vue/blob/next/packages/vue-server-renderer/README.md#component-caching
3436
serverCacheKey: props => {
35-
return `${props.item.id}::${props.item.__lastUpdated}`
37+
return `${
38+
props.item.id
39+
}::${
40+
props.item.__lastUpdated
41+
}::${
42+
timeAgo(props.item.time)
43+
}`
3644
}
3745
}
3846
</script>

0 commit comments

Comments
 (0)