-
-
Notifications
You must be signed in to change notification settings - Fork 827
hide already chosen results from AddressPickerDialog #2000
Conversation
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
@@ -510,6 +510,10 @@ module.exports = React.createClass({ | |||
const AddressSelector = sdk.getComponent("elements.AddressSelector"); | |||
this.scrollElement = null; | |||
|
|||
// Use set to avoid O(n*m) operation | |||
const selectedAddresses = new Set(this.state.userList.map(({address}) => address)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename userList
and selectedAddresses
to selectedList
and likewise rename queryList
to suggestedList
.
@t3chguy, wdyt? Worth the faff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}); | ||
|
||
const queryList = this.state.queryList.filter(({address, addressType}) => { | ||
return !selectedAddresses[addressType] || !selectedAddresses[addressType].has(address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be easier to grok if it were !(condition and condition)
imo. It should make it clearer that the first condition is a effectively a null-guard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
first half of #1678
Fixes element-hq/element-web#5792