Skip to content

Commit

Permalink
fix(multishift): fix a potential out of range error (#1613)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Apr 25, 2022
1 parent 062b01e commit ebacaea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/brave-dragons-press.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'multishift': patch
---

Fix a potential out of range error.
4 changes: 3 additions & 1 deletion packages/multishift/src/multishift-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,9 @@ export function getHighlightedIndexes<Item = any>({

const hoveredIndexes = isValidIndex(hoveredIndex) ? [hoveredIndex] : [];

return uniqueArray([...hoveredIndexes, ...indexes, ...groupIndexes], true);
return uniqueArray([...hoveredIndexes, ...indexes, ...groupIndexes], true).filter(
(index) => 0 <= index && index <= max,
);
}

/**
Expand Down

1 comment on commit ebacaea

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://remirror.io as production
🚀 Deployed on https://62669cfd6ae4010321e8087f--remirror.netlify.app

Please sign in to comment.