RHCLOUD-31826: quick fix for sentry errors when switching between roles and groups #1615
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We have an issue where setting filters in the groups UI then switching to the roles UI is causing sentry errors. See attached RHCLOUD ticket and slack discussion here: https://redhat-internal.slack.com/archives/C05M0SNTLM8/p1712174912636909. This is causing several issues in our test suites. The issue is not reproducible every time in my observations, but if you set the filter and click back and forth enough it will eventually error.
I suspect this may have been introduced in #1601. After that change, while we load the roles UI - we make a request to load the adminGroup here: https://github.com/RedHatInsights/insights-rbac-ui/blob/master/src/smart-components/role/roles.js#L96. The adminGroup is then passed into our
createRows
helpers here: https://github.com/RedHatInsights/insights-rbac-ui/blob/master/src/smart-components/role/roles.js#L182 (which is throwing errors).AFAIK there is no guarantee the adminGroup request will have loaded by the time the UI finishes loading and calls the
createRows
helper (hence adminGroup will be undefined until the request finishes and it makes its way into redux).For now I've simply added an optional chaining check to the line that was throwing the sentry error. I think long term we need a few changes:
undefined | Object
https://issues.redhat.com/browse/RHCLOUD-31826
Screenshots
Before:
After:
Checklist ☑️