Skip to content

Conversation

@Dmytro-Melnyshyn
Copy link
Contributor

@Dmytro-Melnyshyn Dmytro-Melnyshyn commented Dec 26, 2025

Purpose

  1. Display 0 when there are no user roles assigned.
  2. Add an undefined check for assignedRoleIds[tenantId] to avoid page crashing.
  3. Invalidate the cache of user roles after an update to avoid displaying incorrect data.

Issues

https://folio-org.atlassian.net/browse/UIU-3499

Approach

TODOS and Open Questions

Learning

Pre-Merge Checklist

Before merging this PR, please go through the following list and take appropriate actions.

  • I've added appropriate record to the CHANGELOG.md
  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • If any API-related changes - okapi interfaces and permissions are reviewed/changed correspondingly
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

@github-actions
Copy link

github-actions bot commented Dec 26, 2025

Jest Unit Test Results

    1 files  ±0    274 suites  ±0   5m 48s ⏱️ +9s
1 312 tests +1  1 309 ✅ +1  3 💤 ±0  0 ❌ ±0 
1 353 runs  +1  1 350 ✅ +1  3 💤 ±0  0 ❌ ±0 

Results for commit de2c81b. ± Comparison against base commit 5e0c77e.

♻️ This comment has been updated with latest results.

@Dmytro-Melnyshyn Dmytro-Melnyshyn changed the title UIU-3499: Handle an undefined of assignedRoleIds in UserRolesModal. Clear update cache after roles update to avoid displaying incorrect data (follow-up). UIU-3499: Handle an undefined of assignedRoleIds in UserRolesModal. Clear cache after roles update to avoid displaying incorrect data (follow-up). Dec 26, 2025
@Dmytro-Melnyshyn Dmytro-Melnyshyn changed the title UIU-3499: Handle an undefined of assignedRoleIds in UserRolesModal. Clear cache after roles update to avoid displaying incorrect data (follow-up). UIU-3499: Handle an undefined of assignedRoleIds in UserRolesModal. Clear cache after roles update to avoid displaying stale data (follow-up). Dec 26, 2025
@Dmytro-Melnyshyn Dmytro-Melnyshyn force-pushed the UIU-3499 branch 2 times, most recently from 2738652 to 76797d0 Compare December 29, 2025 09:34
…lear update cache after roles update to avoid displaying incorrect data.
@sonarqubecloud
Copy link

@Dmytro-Melnyshyn Dmytro-Melnyshyn requested a review from a team December 29, 2025 10:01
@Dmytro-Melnyshyn Dmytro-Melnyshyn merged commit 4f42410 into master Dec 29, 2025
15 checks passed
@Dmytro-Melnyshyn Dmytro-Melnyshyn deleted the UIU-3499 branch December 29, 2025 11:34
Dmytro-Melnyshyn added a commit that referenced this pull request Dec 29, 2025
…lear update cache after roles update to avoid displaying incorrect data. (#3001)
Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look fine, though I don't see how assignedRoleIds was ever undefined; it's initialized to an empty object so the swap from

assignedRoleIds[tenantId] ? assignedRoleIds[tenantId].concat(id) : [id]

to

(assignedRoleIds[tenantId] || []).concat(id)

should not have had any effect. Am I missing something?

Please address Sonar's complaint before you merge to avoid adding new tech-debt.

Comment on lines -72 to +87
}).catch(sendErrorCallout);
})
.then(async () => {
await queryClient.invalidateQueries({ queryKey: [namespace, userId, tenantIdKey] });
})
.catch(sendErrorCallout);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sonar is grumpy about how deeply nested this is. Let's convert it all to async/await instead of mixing that with promise chaining. I think that'll satisfy Sonar, and it'll be more consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants