Make removedTags a Set for perf

pull/21833/head
Luke Barnard 2018-02-13 14:43:34 +00:00
parent e3f68f12c8
commit 5af560f625
1 changed files with 3 additions and 3 deletions

View File

@ -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);