Firstly, thanks for your work on this project! π
Today I used patch-package to patch @react-md/utils@4.0.3 for the project I'm working on.
I have a dropdown that has no values in some cases (probably the best would be to not show the empty dropdown but that's how I got this error triggered). If typing with the dropdown open it will fail in react-md code as it will try to access the array in an invalid index. endIndex should not be above the values array length...
Here is the diff that solved my problem:
diff --git a/node_modules/@react-md/utils/es/search/findMatchIndex.js b/node_modules/@react-md/utils/es/search/findMatchIndex.js
index fab3aa8..60b3795 100644
--- a/node_modules/@react-md/utils/es/search/findMatchIndex.js
+++ b/node_modules/@react-md/utils/es/search/findMatchIndex.js
@@ -43,7 +43,7 @@ export function findMatchIndex(value, values, startIndex, isSelfMatchable) {
if (isSelfMatchable === void 0) { isSelfMatchable = true; }
var index = findMatchInRange(value, values, startIndex + 1, values.length);
if (index === -1) {
- var endIndex = startIndex + (isSelfMatchable ? 1 : 0);
+ var endIndex = Math.min(startIndex + (isSelfMatchable ? 1 : 0), values.length);
index = findMatchInRange(value, values, 0, endIndex);
}
return index;
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
@react-md/utils@4.0.3
for the project I'm working on.I have a dropdown that has no values in some cases (probably the best would be to not show the empty dropdown but that's how I got this error triggered). If typing with the dropdown open it will fail in react-md code as it will try to access the array in an invalid index. endIndex should not be above the values array length...
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.