[appdef-2] event manager selector bug (#7631)

* fixes: on selecting query - 3 outbound calls are done to the server, and event manager re-renders 3times resulting in flikering ui

* reduces outbound calls for updating csa actions to 1
This commit is contained in:
Arpit 2023-10-06 15:27:50 +05:30 committed by GitHub
parent 447686eabf
commit d0895eb92c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -226,6 +226,28 @@ export const EventManager = ({
}));
}
function handleQueryChange(index, updates) {
let newEvents = _.cloneDeep(events);
let updatedEvent = newEvents[index];
updatedEvent.event = {
...updatedEvent.event,
...updates,
};
newEvents[index] = updatedEvent;
updateAppVersionEventHandlers(
[
{
event_id: updatedEvent.id,
diff: updatedEvent,
},
],
'update'
);
}
function handlerChanged(index, param, value) {
let newEvents = _.cloneDeep(events);
@ -509,9 +531,12 @@ export const EventManager = ({
}),
{}
);
handlerChanged(index, 'queryId', query.id);
handlerChanged(index, 'queryName', query.name);
handlerChanged(index, 'parameters', parameters);
handleQueryChange(index, {
queryId: query.id,
queryName: query.name,
parameters: parameters,
});
}}
placeholder={t('globals.select', 'Select') + '...'}
styles={styles}
@ -743,7 +768,6 @@ export const EventManager = ({
value={event?.componentId}
search={true}
onChange={(value) => {
handlerChanged(index, 'componentSpecificActionHandle', '');
handlerChanged(index, 'componentId', value);
}}
placeholder={t('globals.select', 'Select') + '...'}