only add isDisabled when needed otherwise (#289)
as before it would override an existing isDisabled
This commit is contained in:
parent
853fd2c220
commit
be2268df2f
2 changed files with 5 additions and 7 deletions
|
@ -99,19 +99,18 @@ export const FormAccess = ({
|
|||
return child;
|
||||
});
|
||||
};
|
||||
|
||||
const isDisabled = !hasAccess(role) && !fineGrainedAccess;
|
||||
|
||||
return (
|
||||
<>
|
||||
{!unWrap && (
|
||||
<Form {...rest}>
|
||||
{recursiveCloneChildren(children, {
|
||||
isDisabled: !hasAccess(role) && !fineGrainedAccess,
|
||||
})}
|
||||
{recursiveCloneChildren(children, isDisabled ? { isDisabled } : {})}
|
||||
</Form>
|
||||
)}
|
||||
{unWrap &&
|
||||
recursiveCloneChildren(children, {
|
||||
isDisabled: !hasAccess(role) && !fineGrainedAccess,
|
||||
})}
|
||||
recursiveCloneChildren(children, isDisabled ? { isDisabled } : {})}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -41,7 +41,6 @@ exports[`<FormAccess /> render normal form 1`] = `
|
|||
>
|
||||
<TextInput
|
||||
id="field"
|
||||
isDisabled={false}
|
||||
key=".0"
|
||||
name="fieldName"
|
||||
type="text"
|
||||
|
|
Loading…
Reference in a new issue