We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 382e315 commit 0286010Copy full SHA for 0286010
portal-ui/src/common/SecureComponent/SecureComponent.tsx
@@ -58,12 +58,15 @@ const SecureComponent = ({
58
resource,
59
}: ISecureComponentProps) => {
60
const permissionGranted = hasPermission(resource, scopes, matchAll);
61
- const childComponent = <>{children}</>;
62
if (!permissionGranted && !errorProps) return <RenderError />;
63
if (!permissionGranted && errorProps) {
64
- return cloneElement(childComponent, { ...errorProps });
+ return Array.isArray(children) ? (
+ <>{children.map((child) => cloneElement(child, { ...errorProps }))}</>
65
+ ) : (
66
+ cloneElement(children, { ...errorProps })
67
+ );
68
}
- return childComponent;
69
+ return <>{children}</>;
70
};
71
72
export default SecureComponent;
0 commit comments