deduplicate keys in prefs.subscribe

This commit is contained in:
tophf 2021-03-14 20:30:44 +03:00
parent a7ae3fbc55
commit 21d902c48c

View File

@ -197,7 +197,8 @@
async subscribe(keys, fn, {runNow} = {}) {
const toRun = [];
if (keys) {
for (const key of Array.isArray(keys) ? keys : [keys]) {
const uniqKeys = new Set(Array.isArray(keys) ? keys : [keys]);
for (const key of uniqKeys) {
if (!isKnown(key)) continue;
const listeners = onChange.specific[key] ||
(onChange.specific[key] = new Set());