-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix always loading RBACProvider on empty appName #1900
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have just one minor concern about firing multiple times the request to fetch permissions.
@@ -38,9 +38,7 @@ export const RBACProvider: React.FunctionComponent<RBACProviderProps> = ({ appNa | |||
}; | |||
|
|||
useEffect(() => { | |||
if (appName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would trigger the call to fetch permissions twice. It could be better to allow null
value to be passed as appName
and if such value request empty application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this makes sense. Added null
support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would flip it arround, if null
or string
fire a fetchPermissions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karelhala, implemented
ec4f350
to
e8a42f0
Compare
This fixes the RBACProvider component: now, with the empty appName property, it fetches permissions and update the state properly.
e8a42f0
to
80271ef
Compare
:soon::shipit::octocat: |
🌱 🌸 🌷 🌻 🌟 New version of package has been released 🌟 🌻 🌷 🌸 🌱 The release is available on: :package:@redhat-cloud-services/frontend-components/v/4.0.2📦 :boom:This feature is brought to you by probot🚀 |
This fixes the RBACProvider component: now, with the empty appName property, it fetches permissions and update the state properly. This way, it is not stuck in the always loading state, and all the permissions from all scopes are fetched (empty
appName
== we request all of the user's permissions).