Merge branch 'fix/user-timeline-not-loading' into 'develop'

Fix #262 user timelines bugging

Closes #262

See merge request pleroma/pleroma-fe!454
This commit is contained in:
Shpuld Shpludson 2019-01-09 20:56:09 +00:00
commit 499c6b85d4
2 changed files with 5 additions and 5 deletions

View file

@ -2,7 +2,7 @@ import { includes, remove, slice, sortBy, toInteger, each, find, flatten, maxBy,
import apiService from '../services/api/api.service.js'
// import parse from '../services/status_parser/status_parser.js'
const emptyTl = () => ({
const emptyTl = (userId = 0) => ({
statuses: [],
statusesObject: {},
faves: [],
@ -14,8 +14,8 @@ const emptyTl = () => ({
loading: false,
followers: [],
friends: [],
userId: 0,
flushMarker: 0
flushMarker: 0,
userId
})
export const defaultState = {
@ -346,7 +346,7 @@ export const mutations = {
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
},
clearTimeline (state, { timeline }) {
state.timelines[timeline] = emptyTl()
state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
},
setFavorited (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id]

View file

@ -31,7 +31,7 @@ const fetchAndUpdate = ({store, credentials, timeline = 'friends', older = false
return apiService.fetchTimeline(args)
.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 })
}
update({store, statuses, timeline, showImmediately, userId})