Skip to content

Commit 81d1642

Browse files
Fix permission guard to forward ref (#2053)
<!-- Ensure the title clearly reflects what was changed. Provide a clear and concise description of the changes made. The PR should only contain the changes related to the issue, and no other unrelated changes. --> Fixes OPS-3833
1 parent 88e12d8 commit 81d1642

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22

33
import { Permission } from '@openops/shared';
4+
import { Slot } from '@radix-ui/react-slot';
45

56
type PermissionGuardProps = {
67
permission: Permission | Permission[];
@@ -9,6 +10,15 @@ type PermissionGuardProps = {
910
tooltipLocation?: 'bottom' | 'left';
1011
};
1112

12-
export const PermissionGuard = ({ children }: PermissionGuardProps) => {
13-
return children;
14-
};
13+
export const PermissionGuard = React.forwardRef<
14+
HTMLElement,
15+
PermissionGuardProps
16+
>(({ children, ...rest }, ref) => {
17+
return (
18+
<Slot ref={ref} {...rest}>
19+
{children}
20+
</Slot>
21+
);
22+
});
23+
24+
PermissionGuard.displayName = 'PermissionGuard';

0 commit comments

Comments
 (0)