Skip to content

Conversation

@jmgasper
Copy link
Collaborator

@jmgasper jmgasper requested a review from kkartunov as a code owner November 11, 2025 23:43
@jmgasper jmgasper merged commit 44f5417 into dev Nov 11, 2025
4 of 6 checks passed
submission,
}))

entries.sort((a: SubmissionScoreEntry, b: SubmissionScoreEntry) => {

Choose a reason for hiding this comment

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

[⚠️ performance]
The sorting logic in sortSubmissionsByReviewScoreDesc could be optimized by using a single comparison function. Consider using localeCompare for string comparisons or directly comparing numbers to simplify the logic.

const selectedTab = props.selectedTab
const providedReviews = props.reviews
const providedSubmitterReviews = props.submitterReviews
const normalizedSelectedTab = useMemo(

Choose a reason for hiding this comment

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

[💡 maintainability]
The useMemo hook for normalizedSelectedTab is used correctly, but ensure that the normalizeTabLabel function is pure and does not have side effects, as it could lead to unexpected behavior.

() => normalizeTabLabel(selectedTab),
[selectedTab],
)
const shouldSortReviewTabByScore = useMemo(

Choose a reason for hiding this comment

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

[💡 performance]
The useMemo hook for shouldSortReviewTabByScore is used correctly, but be cautious about the dependency array. If props.isActiveChallenge or normalizedSelectedTab change frequently, it could lead to unnecessary re-renders.

[resolvedSubmitterReviews],
)
const reviewerRowsForReviewTab = useMemo(
() => (shouldSortReviewTabByScore

Choose a reason for hiding this comment

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

[💡 maintainability]
The useMemo hook for reviewerRowsForReviewTab and submitterRowsForReviewTab is used correctly, but ensure that sortSubmissionsByReviewScoreDesc is a pure function without side effects to avoid unexpected behavior.

className?: string
}

const normalizePhaseName = (name?: string): string => (name ? name.trim()

Choose a reason for hiding this comment

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

[💡 style]
Consider using name?.trim().toLowerCase() ?? '' instead of the ternary operator for a more concise and idiomatic approach to handle optional chaining and default values.

return
}

allowed.add(phase.predecessor)

Choose a reason for hiding this comment

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

[⚠️ maintainability]
The allowed.add(phase.predecessor) call is duplicated in the challengePhases.forEach loop and the addPhaseIdentifiers function. Consider removing the duplication to improve maintainability.

})

const hasSubmissionVariantOpen = challengePhases.some(phase => (
phase?.isOpen && SUBMISSION_PHASE_NAMES.has(normalizePhaseName(phase.name))

Choose a reason for hiding this comment

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

[⚠️ performance]
The normalizePhaseName function is called multiple times for the same phase name. Consider normalizing the phase name once and storing it in a variable to improve performance.

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