Skip to content
Snippets Groups Projects
Commit ba2e05bc authored by Dave LiPuma's avatar Dave LiPuma
Browse files

#392: stale data served to new user account

parent 24f3770f
No related branches found
No related tags found
4 merge requests!673Update master with bugfixes (and other changes),!660[i18n] Update: occitan language,!648WIP: Merge develop into mastoapi-exploration,!625#392: stale data served to new user account
......@@ -11,7 +11,8 @@ const Notifications = {
const store = this.$store
const credentials = store.state.users.currentUser.credentials
notificationsFetcher.startFetching({ store, credentials })
const fetcherId = notificationsFetcher.startFetching({ store, credentials })
this.$store.commit('setNotificationFetcher', { fetcherId })
},
data () {
return {
......
import { remove, slice, each, find, maxBy, minBy, merge, last, isArray } from 'lodash'
import { remove, slice, each, find, maxBy, minBy, merge, last, isArray, cloneDeep } from 'lodash'
import apiService from '../services/api/api.service.js'
// import parse from '../services/status_parser/status_parser.js'
......@@ -29,7 +29,8 @@ export const defaultState = {
data: [],
idStore: {},
loading: false,
error: false
error: false,
fetcherId: null
},
favorites: new Set(),
error: false,
......@@ -321,6 +322,14 @@ export const mutations = {
oldTimeline.visibleStatusesObject = {}
each(oldTimeline.visibleStatuses, (status) => { oldTimeline.visibleStatusesObject[status.id] = status })
},
setNotificationFetcher (state, { fetcherId }) {
state.notifications.fetcherId = fetcherId
},
resetStatuses (state) {
Object.keys(state).forEach(key => {
state[key] = cloneDeep(defaultState[key])
})
},
clearTimeline (state, { timeline }) {
state.timelines[timeline] = emptyTl(state.timelines[timeline].userId)
},
......@@ -371,7 +380,7 @@ export const mutations = {
}
const statuses = {
state: defaultState,
state: cloneDeep(defaultState),
actions: {
addNewStatuses ({ rootState, commit }, { statuses, showImmediately = false, timeline = false, noIdUpdate = false, userId }) {
commit('addNewStatuses', { statuses, showImmediately, timeline, noIdUpdate, user: rootState.users.currentUser, userId })
......
......@@ -290,6 +290,10 @@ const users = {
store.commit('setToken', false)
store.dispatch('stopFetching', 'friends')
store.commit('setBackendInteractor', backendInteractorService())
if (store.rootState.statuses.notifications.fetcherId) {
window.clearInterval(store.rootState.statuses.notifications.fetcherId)
}
store.commit('resetStatuses')
},
loginUser (store, accessToken) {
return new Promise((resolve, reject) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment