Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

Related JIRA Ticket:

https://topcoder.atlassian.net/browse/PM-2662

What's in this PR?

  • Show only users submission in review tab if challenge is configured to hide submissions

.toLowerCase() === 'true')
}, [challengeInfo])

const canViewSubmissions = useMemo(() => {

Choose a reason for hiding this comment

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

[💡 readability]
The canViewSubmissions logic could be simplified by directly returning the result of the condition without the if statement. This would improve readability.

[mappingReviewAppeal, reviewers, submissionsForAggregation],
)

const filterFunc = (submissions: SubmissionRow[]): SubmissionRow[] => submissions

Choose a reason for hiding this comment

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

[💡 readability]
Consider renaming filterFunc to something more descriptive like filterSubmissionsByViewPermission to clarify its purpose.

[mappingReviewAppeal, reviewers, submissionsForAggregation],
)

const filterFunc = useCallback((submissions: SubmissionRow[]): SubmissionRow[] => submissions

Choose a reason for hiding this comment

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

[⚠️ correctness]
The useCallback hook is used here, which is appropriate for memoizing the filterFunc function. However, ensure that the dependencies [canViewSubmissions, loginUserInfo?.userId] are correct and complete. If any other variables from the outer scope are used within filterFunc, they should be included in the dependency array to prevent stale closures.

@kkartunov kkartunov merged commit 2e1fc7d into dev Dec 11, 2025
8 checks passed
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.

3 participants