forked from AkkomaGang/akkoma-fe
Clear timeline on user change.
This commit is contained in:
parent
2e7029b670
commit
bda0a76c89
2 changed files with 16 additions and 0 deletions
|
@ -3,6 +3,7 @@ import Timeline from '../timeline/timeline.vue'
|
|||
|
||||
const UserProfile = {
|
||||
created () {
|
||||
this.$store.commit('clearTimeline', { timeline: 'user' })
|
||||
this.$store.dispatch('startFetching', ['user', this.userId])
|
||||
},
|
||||
destroyed () {
|
||||
|
|
|
@ -295,6 +295,21 @@ export const mutations = {
|
|||
oldTimeline.visibleStatusesObject = {}
|
||||
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
|
||||
},
|
||||
clearTimeline (state, { timeline }) {
|
||||
const emptyTimeline = {
|
||||
statuses: [],
|
||||
statusesObject: {},
|
||||
faves: [],
|
||||
visibleStatuses: [],
|
||||
visibleStatusesObject: {},
|
||||
newStatusCount: 0,
|
||||
maxId: 0,
|
||||
minVisibleId: 0,
|
||||
loading: false
|
||||
}
|
||||
|
||||
state.timelines[timeline] = emptyTimeline
|
||||
},
|
||||
setFavorited (state, { status, value }) {
|
||||
const newStatus = state.allStatusesObject[status.id]
|
||||
newStatus.favorited = value
|
||||
|
|
Loading…
Reference in a new issue