[Security Solution] Fix edit not working due to state management overwrite in Host isolation exceptions (#116676)
* Fix edit not working due to state management overwrite * clear the form after a succesfull update * Preserve order after editing and adding
This commit is contained in:
parent
7130d6eb45
commit
5afa164ab9
|
@ -42,8 +42,8 @@ export async function getHostIsolationExceptionItems({
|
|||
http,
|
||||
perPage,
|
||||
page,
|
||||
sortField,
|
||||
sortOrder,
|
||||
sortField = 'created_at',
|
||||
sortOrder = 'desc',
|
||||
filter,
|
||||
}: {
|
||||
http: HttpStart;
|
||||
|
|
|
@ -239,10 +239,18 @@ async function updateHostIsolationExceptionsItem(
|
|||
http,
|
||||
entry
|
||||
);
|
||||
|
||||
// notify the update was correct
|
||||
dispatch({
|
||||
type: 'hostIsolationExceptionsFormStateChanged',
|
||||
payload: createLoadedResourceState(response),
|
||||
});
|
||||
|
||||
// clear the form
|
||||
dispatch({
|
||||
type: 'hostIsolationExceptionsFormEntryChanged',
|
||||
payload: undefined,
|
||||
});
|
||||
} catch (error) {
|
||||
dispatch({
|
||||
type: 'hostIsolationExceptionsFormStateChanged',
|
||||
|
|
|
@ -94,7 +94,7 @@ export const HostIsolationExceptionsFormFlyout: React.FC<{}> = memo(() => {
|
|||
type: 'hostIsolationExceptionsMarkToEdit',
|
||||
payload: { id: location.id },
|
||||
});
|
||||
} else {
|
||||
} else if (exception === undefined) {
|
||||
setException(exceptionToEdit);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue