fix: sync across devices for nested settings

This commit is contained in:
xpmb 2025-10-03 22:10:52 +02:00
commit 80db482aac
No known key found for this signature in database
GPG key ID: 275533FC72D25428

View file

@ -718,16 +718,17 @@ function initializeClient(
return;
}
if (
typeof newSetting.value === "object" ||
typeof newSetting.name !== "string" ||
newSetting.name[0] === "_"
) {
if (typeof newSetting.name !== "string" || newSetting.name[0] === "_") {
return;
}
// Allow plain objects for nested settings, but reject arrays and null
if (typeof newSetting.value === "object" && !_.isPlainObject(newSetting.value)) {
return;
}
// We do not need to do write operations and emit events if nothing changed.
if (client.config.clientSettings[newSetting.name] !== newSetting.value) {
if (!_.isEqual(client.config.clientSettings[newSetting.name], newSetting.value)) {
client.config.clientSettings[newSetting.name] = newSetting.value;
// Pass the setting to all clients.