diff --git a/src/components/form-access/FormAccess.tsx b/src/components/form-access/FormAccess.tsx index 3d8eaf453f..6d6c3bebaa 100644 --- a/src/components/form-access/FormAccess.tsx +++ b/src/components/form-access/FormAccess.tsx @@ -99,19 +99,18 @@ export const FormAccess = ({ return child; }); }; + + const isDisabled = !hasAccess(role) && !fineGrainedAccess; + return ( <> {!unWrap && (
- {recursiveCloneChildren(children, { - isDisabled: !hasAccess(role) && !fineGrainedAccess, - })} + {recursiveCloneChildren(children, isDisabled ? { isDisabled } : {})}
)} {unWrap && - recursiveCloneChildren(children, { - isDisabled: !hasAccess(role) && !fineGrainedAccess, - })} + recursiveCloneChildren(children, isDisabled ? { isDisabled } : {})} ); }; diff --git a/src/components/form-access/__tests__/__snapshots__/FormAccess.test.tsx.snap b/src/components/form-access/__tests__/__snapshots__/FormAccess.test.tsx.snap index a0716f0061..55821eba20 100644 --- a/src/components/form-access/__tests__/__snapshots__/FormAccess.test.tsx.snap +++ b/src/components/form-access/__tests__/__snapshots__/FormAccess.test.tsx.snap @@ -41,7 +41,6 @@ exports[` render normal form 1`] = ` >