Skip to content

Commit

Permalink
Simplify isSelected (facebook#2038)
Browse files Browse the repository at this point in the history
* simplify isSelected

* ???
  • Loading branch information
acywatson authored Apr 29, 2022
1 parent 7a4f881 commit fa428ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/lexical/src/LexicalNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ export class LexicalNode {
if (selection == null) {
return false;
}
const selectedNodeKeys = new Set(selection.getNodes().map((n) => n.__key));
const isSelected = selectedNodeKeys.has(this.__key);

const isSelected = selection.getNodes().some((n) => n.__key === this.__key);

if ($isTextNode(this)) {
return isSelected;
Expand Down

0 comments on commit fa428ec

Please sign in to comment.