mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Make removedTags a Set for perf
This commit is contained in:
parent
e3f68f12c8
commit
5af560f625
1 changed files with 3 additions and 3 deletions
|
@ -175,15 +175,15 @@ class TagOrderStore extends Store {
|
||||||
_mergeGroupsAndTags() {
|
_mergeGroupsAndTags() {
|
||||||
const groupIds = this._state.joinedGroupIds || [];
|
const groupIds = this._state.joinedGroupIds || [];
|
||||||
const tags = this._state.orderedTagsAccountData || [];
|
const tags = this._state.orderedTagsAccountData || [];
|
||||||
const removedTags = this._state.removedTagsAccountData || [];
|
const removedTags = new Set(this._state.removedTagsAccountData || []);
|
||||||
|
|
||||||
|
|
||||||
const tagsToKeep = tags.filter(
|
const tagsToKeep = tags.filter(
|
||||||
(t) => (t[0] !== '+' || groupIds.includes(t)) && !removedTags.includes(t),
|
(t) => (t[0] !== '+' || groupIds.includes(t)) && !removedTags.has(t),
|
||||||
);
|
);
|
||||||
|
|
||||||
const groupIdsToAdd = groupIds.filter(
|
const groupIdsToAdd = groupIds.filter(
|
||||||
(groupId) => !tags.includes(groupId) && !removedTags.includes(groupId),
|
(groupId) => !tags.includes(groupId) && !removedTags.has(groupId),
|
||||||
);
|
);
|
||||||
|
|
||||||
return tagsToKeep.concat(groupIdsToAdd);
|
return tagsToKeep.concat(groupIdsToAdd);
|
||||||
|
|
Loading…
Reference in a new issue