Commit b6bac4d0 authored by Shpuld Shpludson's avatar Shpuld Shpludson

Merge branch 'fix/profile-not-loading-without-persisted-state' into 'develop'

Fix #324 Profiles sometimes not loading when there's no persisted state

Closes #324

See merge request !553
parents 0e6134b3 3fb53197
Pipeline #7435 passed with stages
in 3 minutes and 29 seconds
......@@ -55,7 +55,6 @@ const afterStoreSetup = ({ store, i18n }) => {
}
copyInstanceOption('nsfwCensorImage')
copyInstanceOption('theme')
copyInstanceOption('background')
copyInstanceOption('hidePostStats')
copyInstanceOption('hideUserStats')
......@@ -96,6 +95,9 @@ const afterStoreSetup = ({ store, i18n }) => {
store.dispatch('initializeSocket')
}
return store.dispatch('setTheme', config['theme'])
})
.then(() => {
const router = new VueRouter({
mode: 'history',
routes: routes(store),
......
......@@ -48,7 +48,7 @@ export default function createPersistedState ({
return getState(key, storage).then((savedState) => {
return store => {
try {
if (typeof savedState === 'object') {
if (savedState !== null && typeof savedState === 'object') {
// build user cache
const usersState = savedState.users || {}
usersState.usersObject = {}
......
......@@ -66,9 +66,11 @@ const instance = {
case 'name':
dispatch('setPageTitle')
break
case 'theme':
setPreset(value, commit)
}
},
setTheme ({ commit }, themeName) {
commit('setInstanceOption', { name: 'theme', value: themeName })
return setPreset(themeName, commit)
}
}
}
......
......@@ -480,7 +480,7 @@ const getThemes = () => {
}
const setPreset = (val, commit) => {
getThemes().then((themes) => {
return getThemes().then((themes) => {
const theme = themes[val] ? themes[val] : themes['pleroma-dark']
const isV1 = Array.isArray(theme)
const data = isV1 ? {} : theme.theme
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment