fix: network form reset

pull/91/head
corpulent 3 years ago
parent 5b49a6031c
commit 7e8d1a4660

@ -65,7 +65,10 @@ const NetworkList: FunctionComponent<INetworkListProps> = (
const handleEdit = (networkUuid: string) => () => onEdit(networkUuid); const handleEdit = (networkUuid: string) => () => onEdit(networkUuid);
const handleRemove = (networkUuid: string) => () => onRemove(networkUuid); const handleRemove = (e: any, networkUuid: string) => {
e.stopPropagation();
onRemove(networkUuid);
};
return ( return (
<Root> <Root>
@ -83,7 +86,7 @@ const NetworkList: FunctionComponent<INetworkListProps> = (
variant="soft" variant="soft"
size="sm" size="sm"
color="danger" color="danger"
onClick={handleRemove(networkUuid)} onClick={(e) => handleRemove(e, networkUuid)}
> >
<MinusSmIcon className="h-4 w-4" /> <MinusSmIcon className="h-4 w-4" />
</RemoveButton> </RemoveButton>

@ -62,8 +62,6 @@ const ModalNetwork = (props: IModalNetworkProps) => {
const handleRemove = useCallback( const handleRemove = useCallback(
(networkUuid: string) => { (networkUuid: string) => {
onDeleteNetwork(networkUuid); onDeleteNetwork(networkUuid);
/* Show the new network form only when the selected node was deleted. */
/* BUG: If a selected node is deleted, it still remains in the form. */
if (selectedNetwork?.key === networkUuid) { if (selectedNetwork?.key === networkUuid) {
setSelectedNetwork(null); setSelectedNetwork(null);
} }

Loading…
Cancel
Save