deduplicate keys in prefs.subscribe
This commit is contained in:
parent
a7ae3fbc55
commit
21d902c48c
|
@ -197,7 +197,8 @@
|
||||||
async subscribe(keys, fn, {runNow} = {}) {
|
async subscribe(keys, fn, {runNow} = {}) {
|
||||||
const toRun = [];
|
const toRun = [];
|
||||||
if (keys) {
|
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;
|
if (!isKnown(key)) continue;
|
||||||
const listeners = onChange.specific[key] ||
|
const listeners = onChange.specific[key] ||
|
||||||
(onChange.specific[key] = new Set());
|
(onChange.specific[key] = new Set());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user