Skip to content

Commit

Permalink
fix: Fix non-working RBACProvider on empty appName
Browse files Browse the repository at this point in the history
This fixes the RBACProvider component: now, with the empty appName
property, it fetches permissions and update the state properly.
  • Loading branch information
gkarat committed Aug 28, 2023
1 parent a5e01d5 commit ec4f350
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/components/src/RBACProvider/RBACProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const hasAccessWithUserPermissions = (userPermissions: (Access | string)[], chec
};

export interface RBACProviderProps {
appName: string;
checkResourceDefinitions: boolean;
appName?: string;
checkResourceDefinitions?: boolean;
}

export const RBACProvider: React.FunctionComponent<RBACProviderProps> = ({ appName, checkResourceDefinitions = false, children }) => {
Expand All @@ -38,9 +38,7 @@ export const RBACProvider: React.FunctionComponent<RBACProviderProps> = ({ appNa
};

useEffect(() => {
if (appName) {
fetchPermissions();
}
fetchPermissions();
}, [appName]);

return (
Expand Down

0 comments on commit ec4f350

Please sign in to comment.