From babeb9ff139a8c361e78850966e2b64aee3f3b82 Mon Sep 17 00:00:00 2001 From: Elliot Spall <132617474+PuppetFoam@users.noreply.github.com> Date: Wed, 26 Jun 2024 10:02:15 -0400 Subject: [PATCH] Update Dropdown.js Prevent "Uncaught TypeError: Cannot read properties of undefined (reading 'findIndex')" error from being thrown when visibleOptions is null or undefined. --- components/lib/dropdown/Dropdown.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/dropdown/Dropdown.js b/components/lib/dropdown/Dropdown.js index 3bfa61c25b..4c0bee669b 100644 --- a/components/lib/dropdown/Dropdown.js +++ b/components/lib/dropdown/Dropdown.js @@ -656,7 +656,7 @@ export const Dropdown = React.memo( const onEditableInputChange = (event) => { let searchIndex = null; - if (event.target.value) { + if (event.target.value && visibleOptions) { searchIndex = visibleOptions.findIndex((item) => getOptionLabel(item).toLocaleLowerCase().startsWith(event.target.value.toLocaleLowerCase())); }