mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 12:28:50 +03:00
Add more logging to settings watchers
To try and track leaks versus spam. Fixes https://github.com/vector-im/riot-web/issues/12094 (it's not leaking, probably)
This commit is contained in:
parent
e2dd2bd950
commit
2a1407a531
1 changed files with 6 additions and 2 deletions
|
@ -145,7 +145,7 @@ export default class SettingsStore {
|
|||
callbackFn(originalSettingName, changedInRoomId, atLevel, newValAtLevel, newValue);
|
||||
};
|
||||
|
||||
console.log(`Starting watcher for ${settingName}@${roomId || '<null room>'}`);
|
||||
console.log(`Starting watcher for ${settingName}@${roomId || '<null room>'} as ID ${watcherId}`);
|
||||
SettingsStore._watchers[watcherId] = localizedCallback;
|
||||
defaultWatchManager.watchSetting(settingName, roomId, localizedCallback);
|
||||
|
||||
|
@ -159,8 +159,12 @@ export default class SettingsStore {
|
|||
* to cancel.
|
||||
*/
|
||||
static unwatchSetting(watcherReference) {
|
||||
if (!SettingsStore._watchers[watcherReference]) return;
|
||||
if (!SettingsStore._watchers[watcherReference]) {
|
||||
console.warn(`Ending non-existent watcher ID ${watcherReference}`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Ending watcher ID ${watcherReference}`);
|
||||
defaultWatchManager.unwatchSetting(SettingsStore._watchers[watcherReference]);
|
||||
delete SettingsStore._watchers[watcherReference];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue