Fix synchronizing settings on page load

This commit is contained in:
Pavel Djundik 2019-12-15 18:03:13 +02:00
parent 58a558247b
commit 309be48906
4 changed files with 6 additions and 4 deletions

View file

@ -10,8 +10,9 @@ export const config = normalizeConfig({
syncSettings: {
default: true,
sync: "never",
apply(store, value) {
if (value) {
apply(store, value, auto = false) {
// If applied by settings/applyAll, do not emit to server
if (value && !auto) {
socket.emit("setting:get");
}
},

View file

@ -10,7 +10,6 @@ socket.once("configuration", function(data) {
// 'theme' setting depends on serverConfiguration.themes so
// settings cannot be applied before this point
store.dispatch("settings/applyAll");
socket.emit("setting:get");
if (data.fileUpload) {
upload.initialize();

View file

@ -22,6 +22,8 @@ socket.on("init", function(data) {
store.commit("appLoaded");
socket.emit("setting:get");
if (window.g_TheLoungeRemoveLoading) {
window.g_TheLoungeRemoveLoading();
}

View file

@ -27,7 +27,7 @@ export function createSettingsStore(store) {
},
applyAll({state}) {
for (const settingName in config) {
config[settingName].apply(store, state[settingName]);
config[settingName].apply(store, state[settingName], true);
}
},
update({state, commit}, {name, value, sync = false}) {