File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,18 +27,16 @@ export class Selections {
2727 remove ( item ) {
2828 for ( let i = 0 ; i < this . _items . length ; i ++ ) {
2929 const existing = this . _items [ i ]
30+ // we only remove stream selections when the `isStreamSelection` flag match, cast to boolean using !
31+ if ( ! existing . isStreamSelection !== ! item . isStreamSelection ) continue
32+
3033 if ( existing . isStreamSelection ) {
31- if ( item . isStreamSelection ) {
32- // If both are stream selections and they match, then we remove the first matching item, then we break the loop
33- if ( existing . from === item . from && existing . to === item . to ) {
34- this . _items . splice ( i , 1 )
35- // for stream selections, we only remove one item at a time
36- // ergo we break the loop after removing the first matching item
37- break
38- }
39- } else {
40- // we only remove stream selections when the `isStreamSelection` flag is true and they match
41- continue
34+ // If both are stream selections and they match, then we remove the first matching item, then we break the loop
35+ if ( existing . from === item . from && existing . to === item . to ) {
36+ this . _items . splice ( i , 1 )
37+ // for stream selections, we only remove one item at a time
38+ // ergo we break the loop after removing the first matching item
39+ break
4240 }
4341 } else {
4442 if ( isLowerIntersecting ( item , existing ) ) {
You can’t perform that action at this time.
0 commit comments