-
Notifications
You must be signed in to change notification settings - Fork 12.9k
FolderRepo: Prevent no basic role user getting infinite api calls on provisioning settings endpoint #110486
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
Conversation
const hasNoRole = contextSrv.user.orgRole === OrgRole.None; | ||
const skip = !config.featureToggles.provisioning || hasNoRole; | ||
|
||
const settingsQuery = useGetFrontendSettingsQuery(settings || skip ? skipToken : undefined); |
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.
Can we add the same check to BrowseView
, so we don't call the /settings
endpoint for users without a 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.
added 👍🏻
!folder || | ||
Boolean('parentUID' in folder && folder.parentUID) || | ||
folder.managedBy !== ManagerKind.Repo || | ||
isProvisionedInstance; |
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.
Nit: I think the list of conditions is getting large enough to be extracted into a function.
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.
good callout, moved into separate func
// Skip render if parentUID is present, then we should skip rendering. we only display icon for root folders | ||
const hasParent = folder && Boolean('parentUID' in folder && folder.parentUID); | ||
// Skip render if folder is not managed by Repo | ||
const isNotManaged = folder && folder.managedBy !== ManagerKind.Repo; |
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 means that #110467 is no longer needed, right?
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.
yes sorry! I meant to comment in your PR when I returned from doc appointment.
What is this feature?
No basic role
assigned, they are seeing infinite api calls to /settings endpoint.Root cause:
BrowseDashboardsPage
has multiple subscribers (e.g., BrowseView → DashboardsTree → NameCell → FolderRepo), which ends up in an apparent “infinite” call pattern.Why do we need this feature?
Who is this feature for?
Which issue(s) does this PR fix?:
Fixes https://github.com/grafana/git-ui-sync-project/issues/474
Special notes for your reviewer:
Please check that: