mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 01:18:23 +00:00
[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:
parent
447686eabf
commit
d0895eb92c
1 changed files with 28 additions and 4 deletions
|
|
@ -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') + '...'}
|
||||
|
|
|
|||
Loading…
Reference in a new issue