Skip to content

Commit

Permalink
FIX SearchableDropdownField pass incorrect value on onChange event
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed May 6, 2024
1 parent 3434873 commit 2daaf21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const SearchableDropdownField = ({
setHasChanges(true);
setJustChanged(true);
}
onChange(val);
onChange(val, { value: val.value });
};

/**
Expand Down Expand Up @@ -133,6 +133,15 @@ const SearchableDropdownField = ({
}
}

if (typeof val !== 'object' && (options && options.length > 0)) {
options.forEach(option => {
// eslint-disable-next-line eqeqeq
if (option.value == value) {
val = option;
}
});
}

const inputId = `${passThroughProps.id}__input`;

const DynamicComponent = lazyLoad ? AsyncSelectComponent : SelectComponent;
Expand Down

0 comments on commit 2daaf21

Please sign in to comment.