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: { syncSettings: {
default: true, default: true,
sync: "never", sync: "never",
apply(store, value) { apply(store, value, auto = false) {
if (value) { // If applied by settings/applyAll, do not emit to server
if (value && !auto) {
socket.emit("setting:get"); socket.emit("setting:get");
} }
}, },

View file

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

View file

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

View file

@ -27,7 +27,7 @@ export function createSettingsStore(store) {
}, },
applyAll({state}) { applyAll({state}) {
for (const settingName in config) { 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}) { update({state, commit}, {name, value, sync = false}) {