Skip to content

Conversation

@jmgasper
Copy link
Collaborator

@jmgasper jmgasper requested a review from kkartunov as a code owner October 28, 2025 23:48
@jmgasper jmgasper merged commit cbc0120 into dev Oct 28, 2025
6 of 7 checks passed
const baseRows = props.screening ?? []
// Defensive filtering: exclude any entries that don't belong to Screening phase
const phaseValidatedRows = baseRows.filter(row => {
if (!row.reviewId) {

Choose a reason for hiding this comment

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

[❗❗ correctness]
Consider checking for row.phaseName before calling toLowerCase() and trim(). If row.phaseName is null or undefined, this could lead to a runtime error.

)

const hasManagerRole = useMemo(
() => (myRoles ?? [])

Choose a reason for hiding this comment

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

[⚠️ correctness]
Consider using toLowerCase().trim() consistently across all role checks for uniformity and to prevent potential issues with leading/trailing spaces.

?.toLowerCase()
.trim()

if (normalizedPhaseName && normalizedPhaseName !== 'screening') {

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The normalizedPhaseName check ensures that only 'screening' phase data is processed. However, the logic for handling non-'screening' phases is simply returning an empty <span />. Consider logging or handling this case explicitly to avoid silent failures or unexpected behavior.

label: 'Screening Score',
propertyName: 'score',
renderer: (data: Screening) => {
const normalizedPhaseName = data.phaseName

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The normalizedPhaseName check is repeated in multiple places. Consider refactoring this logic into a helper function to improve maintainability and reduce code duplication.

}

if (canViewAllScorecards) {
if (canViewAllScorecards || hasReviewerRole) {

Choose a reason for hiding this comment

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

[💡 readability]
The condition canViewAllScorecards || hasReviewerRole is used multiple times. Consider extracting this logic into a descriptive function or variable to improve readability and maintainability.

[loginUserInfo?.roles],
)
const shouldShowResourcesSection = hasCopilotRole || isAdmin
const shouldShowResourcesSection = hasCopilotRole || hasManagerRole || isAdmin

Choose a reason for hiding this comment

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

[⚠️ correctness]
The addition of hasManagerRole to shouldShowResourcesSection seems to align with the PR's intent to adjust visibility based on roles. Ensure that this change is consistent with the business logic and requirements for role-based access.

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.

2 participants