fix Settings::onChange being fired twice (#3496)

This commit is contained in:
Etorix 2025-06-17 18:55:10 -07:00 committed by GitHub
parent 7779e5a1ec
commit e4b1a196ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -160,7 +160,7 @@ export class SettingsStore<T extends object> {
// So, we need to extract the top-level setting path (plugins.pluginName.settingName),
// to be able to notify globalListeners and top-level setting name listeners (let { settingName } = settings.use(["settingName"]),
// with the new value
if (paths.length > 2 && paths[0] === "plugins") {
if (paths.length > 3 && paths[0] === "plugins") {
const settingPath = paths.slice(0, 3);
const settingPathStr = settingPath.join(".");
const settingValue = settingPath.reduce((acc, curr) => acc[curr], root);