Fix for onSelect event of dropdowns (#722)

* onSelect event for dropdown

* onSelect should be fired after state change
This commit is contained in:
Navaneeth Pk 2021-09-10 12:50:20 +05:30 committed by GitHub
parent 268167a86d
commit 0cbc250689
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,8 @@ export const DropDown = function DropDown({
component,
onComponentClick,
currentState,
onComponentOptionChanged
onComponentOptionChanged,
onEvent
}) {
console.log('currentState', currentState);
@ -78,7 +79,7 @@ export const DropDown = function DropDown({
}, [newValue]);
useEffect(() => {
onComponentOptionChanged(component, 'value', currentValue);
onComponentOptionChanged(component, 'value', currentValue).then(() => onEvent('onSelect', { component }) );
}, [currentValue]);
return (

View file

@ -242,7 +242,7 @@ export async function onEvent(_ref, eventName, options, mode = 'edit') {
});
}
if (['onDetect', 'onCheck', 'onUnCheck', 'onBoundsChange', 'onCreateMarker', 'onMarkerClick', 'onPageChanged', 'onSearch', 'onChange', 'onSelectionChange'].includes(eventName)) {
if (['onDetect', 'onCheck', 'onUnCheck', 'onBoundsChange', 'onCreateMarker', 'onMarkerClick', 'onPageChanged', 'onSearch', 'onChange', 'onSelectionChange', 'onSelect'].includes(eventName)) {
const { component } = options;
executeActionsForEventId(_ref, eventName, component, mode);
}