From 377cf600550da9c1b49924bd996fc86be9011048 Mon Sep 17 00:00:00 2001 From: V Date: Mon, 9 Oct 2023 03:01:35 +0200 Subject: [PATCH] fix global settings listeners --- src/api/Settings.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/Settings.ts b/src/api/Settings.ts index c380f631c..368f88f7a 100644 --- a/src/api/Settings.ts +++ b/src/api/Settings.ts @@ -237,7 +237,8 @@ type ResolvePropDeep = P extends "" ? T : export function addSettingsListener(path: Path, onUpdate: (newValue: Settings[Path], path: Path) => void): void; export function addSettingsListener(path: Path, onUpdate: (newValue: Path extends "" ? any : ResolvePropDeep, path: Path extends "" ? string : Path) => void): void; export function addSettingsListener(path: string, onUpdate: (newValue: any, path: string) => void) { - ((onUpdate as SubscriptionCallback)._paths ??= []).push(path); + if (path) + ((onUpdate as SubscriptionCallback)._paths ??= []).push(path); subscriptions.add(onUpdate); }