You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-14 19:02:33 +03:00
Use a global WatchManager for settings
Fixes https://github.com/vector-im/riot-web/issues/8936 Watchers are now managed by the SettingsStore itself through a global/default watch manager. As per the included documentation, the watch manager dispatches updates to callbacks which are redirected by the SettingsStore for consumer safety.
This commit is contained in:
@@ -41,7 +41,11 @@ export class WatchManager {
|
||||
}
|
||||
}
|
||||
|
||||
notifyUpdate(settingName, inRoomId, newValue) {
|
||||
notifyUpdate(settingName, inRoomId, atLevel, newValueAtLevel) {
|
||||
// Dev note: We could avoid raising changes for ultimately inconsequential changes, but
|
||||
// we also don't have a reliable way to get the old value of a setting. Instead, we'll just
|
||||
// let it fall through regardless and let the receiver dedupe if they want to.
|
||||
|
||||
if (!this._watchers[settingName]) return;
|
||||
|
||||
const roomWatchers = this._watchers[settingName];
|
||||
@@ -51,7 +55,7 @@ export class WatchManager {
|
||||
if (roomWatchers[null]) callbacks.push(...roomWatchers[null]);
|
||||
|
||||
for (const callback of callbacks) {
|
||||
callback(inRoomId, newValue);
|
||||
callback(inRoomId, atLevel, newValueAtLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user