🐛 fix(EditNodeModal): setAdv state variable to null initially to avoid undefined value

🐛 fix(types): change advanced prop type in KeyPairListComponentType to allow null value
This commit is contained in:
Cristhian Zanforlin Lousa 2023-09-28 18:41:26 -03:00
commit 9d9a1177f2
2 changed files with 16 additions and 18 deletions

View file

@ -76,6 +76,7 @@ const EditNodeModal = forwardRef(
function changeAdvanced(n) {
myData.current.node!.template[n].advanced =
!myData.current.node!.template[n].advanced;
setAdv(!adv);
}
const handleOnNewValue = (newValue: any, name) => {
@ -88,6 +89,7 @@ const EditNodeModal = forwardRef(
}, [modalOpen]);
const [errorDuplicateKey, setErrorDuplicateKey] = useState(false);
const [adv, setAdv] = useState<boolean | null>(null);
return (
<BaseModal
@ -266,11 +268,7 @@ const EditNodeModal = forwardRef(
)}
>
<KeypairListComponent
advanced={
myData.current.node?.template[
templateParam
].advanced
}
advanced={adv}
disabled={disabled}
editNode={true}
value={

View file

@ -61,7 +61,7 @@ export type KeyPairListComponentType = {
disabled: boolean;
editNode?: boolean;
duplicateKey?: boolean;
advanced?: boolean;
advanced?: boolean | null;
};
export type DictComponentType = {
@ -135,18 +135,18 @@ export type TooltipComponentType = {
children: ReactElement;
title: string | ReactElement;
placement?:
| "bottom-end"
| "bottom-start"
| "bottom"
| "left-end"
| "left-start"
| "left"
| "right-end"
| "right-start"
| "right"
| "top-end"
| "top-start"
| "top";
| "bottom-end"
| "bottom-start"
| "bottom"
| "left-end"
| "left-start"
| "left"
| "right-end"
| "right-start"
| "right"
| "top-end"
| "top-start"
| "top";
};
export type ProgressBarType = {