-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Refresh resources after dropping an access request #49125
base: master
Are you sure you want to change the base?
Conversation
const requestResourcesRefresh = useCallback( | ||
() => emitterRef.current.emit('refresh'), | ||
(rootClusterUri: RootClusterUri) => |
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.
What do you think about making the hook accept the rootClusterUri
argument? Then the caller doesn't need to remember to pass it to every function that the hook provides.
ctx.clustersService.dropRoles(rootClusterUri, [assumedRequest.id]) | ||
); | ||
requestResourcesRefresh(rootClusterUri); | ||
} catch (err) { | ||
ctx.notificationsService.notifyError({ | ||
title: 'Could not switch back the role', |
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 know this error text was already present but it seems so weird. I think it'd be better saying something like "Could not drop role" or "Could not switch back to default role" or something. Don't have to change here, just discussing.
Closes #42381
As mentioned in the linked issue, we were unable to refresh resources after dropping an access request because
ResourcesContext
was lower in the component tree, so we simply couldn't access it.A simple fix for this problem is to move it higher in the tree and add a root cluster URI as an argument to its functions, so we can still refresh resources within a single workspace.
Changelog: Teleport Connect now refreshes the resources view after dropping an access request