From a8f7e381ebcfcaa20cdf4b5a074251554bc40287 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Tue, 4 Feb 2020 10:41:48 +0000
Subject: [PATCH 1/2] SettingsStore, use a counter instead of wall clock for
 watcher ids

---
 src/settings/SettingsStore.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/settings/SettingsStore.js b/src/settings/SettingsStore.js
index b1d61197a0..7c562f3514 100644
--- a/src/settings/SettingsStore.js
+++ b/src/settings/SettingsStore.js
@@ -113,6 +113,9 @@ export default class SettingsStore {
     static _watchers = {}; // { callbackRef => { callbackFn } }
     static _monitors = {}; // { settingName => { roomId => callbackRef } }
 
+    // Counter used for generation of watcher IDs
+    static _watcherCount = 1;
+
     /**
      * Watches for changes in a particular setting. This is done without any local echo
      * wrapping and fires whenever a change is detected in a setting's value, at any level.
@@ -138,7 +141,7 @@ export default class SettingsStore {
             settingName = setting.invertedSettingName;
         }
 
-        const watcherId = `${new Date().getTime()}_${settingName}_${roomId}`;
+        const watcherId = `${SettingsStore._watcherCount++}_${settingName}_${roomId}`;
 
         const localizedCallback = (changedInRoomId, atLevel, newValAtLevel) => {
             const newValue = SettingsStore.getValue(originalSettingName);

From f6c7df8c6946737fd3a9d588e539aae2b9b470ec Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Tue, 4 Feb 2020 11:14:49 +0000
Subject: [PATCH 2/2] Keep date in Watcher IDs

---
 src/settings/SettingsStore.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/settings/SettingsStore.js b/src/settings/SettingsStore.js
index 7c562f3514..d9acc426bf 100644
--- a/src/settings/SettingsStore.js
+++ b/src/settings/SettingsStore.js
@@ -141,7 +141,7 @@ export default class SettingsStore {
             settingName = setting.invertedSettingName;
         }
 
-        const watcherId = `${SettingsStore._watcherCount++}_${settingName}_${roomId}`;
+        const watcherId = `${new Date().getTime()}_${SettingsStore._watcherCount++}_${settingName}_${roomId}`;
 
         const localizedCallback = (changedInRoomId, atLevel, newValAtLevel) => {
             const newValue = SettingsStore.getValue(originalSettingName);