Retain userId on clearing user timeline, don't flush when empty timeline

This commit is contained in:
shpuld 2019-01-08 23:09:03 +02:00
parent 76cfb15b3c
commit a8f6099be2
2 changed files with 3 additions and 1 deletions

View File

@ -346,7 +346,9 @@ export const mutations = {
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status }) each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
}, },
clearTimeline (state, { timeline }) { clearTimeline (state, { timeline }) {
const userId = state.timelines[timeline].userId
state.timelines[timeline] = emptyTl() state.timelines[timeline] = emptyTl()
state.timelines[timeline].userId = userId
}, },
setFavorited (state, { status, value }) { setFavorited (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id] const newStatus = state.allStatusesObject[status.id]

View File

@ -31,7 +31,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
return apiService.fetchTimeline(args) return apiService.fetchTimeline(args)
.then((statuses) => { .then((statuses) => {
if (!older && statuses.length >= 20 && !timelineData.loading) { if (!older && statuses.length >= 20 && !timelineData.loading && timelineData.statuses.length) {
store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId }) store.dispatch('queueFlush', { timeline: timeline, id: timelineData.maxId })
} }
update({store, statuses, timeline, showImmediately, userId}) update({store, statuses, timeline, showImmediately, userId})