fix: push settings val to listener

This commit is contained in:
Julian Krauser 2025-05-08 08:13:59 +02:00
parent 025cd555e9
commit 0dbc726f64

View file

@ -265,9 +265,7 @@ export default abstract class SettingHelper {
* @param oldValue The old value
*/
private static notifyListeners(key: SettingString, newValue: any, oldValue: any): void {
if (!this.listeners.has(key)) return;
const callbacks = this.listeners.get(key)!;
const callbacks = this.listeners.get(key) ?? [];
for (const callback of callbacks) {
try {
callback(newValue, oldValue);
@ -276,7 +274,7 @@ export default abstract class SettingHelper {
}
}
const topicCallbacks = this.topicListeners.get(key.split(".")[0] as SettingTopic)!;
const topicCallbacks = this.topicListeners.get(key.split(".")[0] as SettingTopic) ?? [];
for (const callback of topicCallbacks) {
try {
callback();