Skip to content

Commit e5b4abe

Browse files
authored
fix: rebuild allAutoStickyStates with nested iteration instead of flat() (#3840)
Array.prototype.flat() only flattens arrays, not Sets. Since autoStickyStates is a Map<string, Set<string>>, spreading its values and calling flat() resulted in Set objects themselves being stored in allAutoStickyStates instead of their individual state strings.
1 parent 7b88c5a commit e5b4abe

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

webextensions/common/TreeItem.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,12 @@ export class TreeItem {
797797
else
798798
TreeItem.autoStickyStates.delete(providerId);
799799

800-
TreeItem.allAutoStickyStates = new Set([
801-
...TreeItem.autoStickyStates.values(),
802-
].flat());
800+
TreeItem.allAutoStickyStates = new Set();
801+
for (const states of TreeItem.autoStickyStates.values()) {
802+
for (const state of states) {
803+
TreeItem.allAutoStickyStates.add(state);
804+
}
805+
}
803806

804807
TreeItem.updateCanBecomeStickyTabsIndex(TabsStore.getCurrentWindowId());
805808

0 commit comments

Comments
 (0)