Skip to content
Snippets Groups Projects
Commit ae388d79 authored by lain's avatar lain
Browse files

Be strict about putting changes in mutations.

parent e892fffd
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,8 @@ const store = new Vuex.Store({
api: apiModule,
config: configModule
},
plugins: [createPersistedState(persistedStateOptions)]
plugins: [createPersistedState(persistedStateOptions)],
strict: process.env.NODE_ENV !== 'production'
})
const routes = [
......
......@@ -33,6 +33,9 @@ export const mutations = {
},
addNewUsers (state, users) {
each(users, (user) => mergeOrAdd(state.users, user))
},
setUserForStatus (state, status) {
status.user = find(state.users, status.user)
}
}
......@@ -54,11 +57,11 @@ const users = {
// Reconnect users to statuses
each(statuses, (status) => {
status.user = find(store.state.users, status.user)
store.commit('setUserForStatus', status)
})
// Reconnect users to retweets
each(compact(map(statuses, 'retweeted_status')), (status) => {
status.user = find(store.state.users, status.user)
store.commit('setUserForStatus', status)
})
},
loginUser (store, userCredentials) {
......
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