@@ -6,7 +6,14 @@ import { EnvironmentConfig } from '~/config'
66import { getRatingColor , xhrGetAsync } from '~/libs/core'
77import { handleError } from '~/libs/shared'
88
9- import { DESIGN , REVIEWER , SUBMITTER } from '../../config/index.config'
9+ import {
10+ ADMIN ,
11+ COPILOT ,
12+ DESIGN ,
13+ MANAGER ,
14+ REVIEWER ,
15+ SUBMITTER ,
16+ } from '../../config/index.config'
1017import { ChallengeDetailContext , ReviewAppContext } from '../contexts'
1118import {
1219 BackendPhase ,
@@ -1225,6 +1232,37 @@ export function useFetchScreeningReview(): useFetchScreeningReviewProps {
12251232 [ reviewerIds ] ,
12261233 )
12271234
1235+ const shouldForceReviewFetch = useMemo (
1236+ ( ) => {
1237+ const normalizedActionRole = actionChallengeRole ?? ''
1238+
1239+ if (
1240+ normalizedActionRole === SUBMITTER
1241+ || normalizedActionRole === REVIEWER
1242+ || normalizedActionRole === COPILOT
1243+ || normalizedActionRole === ADMIN
1244+ || normalizedActionRole === MANAGER
1245+ ) {
1246+ return true
1247+ }
1248+
1249+ return ( myResources ?? [ ] ) . some ( resource => {
1250+ const normalizedRoleName = ( resource . roleName ?? '' ) . toLowerCase ( )
1251+
1252+ if ( ! normalizedRoleName ) {
1253+ return false
1254+ }
1255+
1256+ return normalizedRoleName . includes ( 'screener' )
1257+ || normalizedRoleName . includes ( 'reviewer' )
1258+ || normalizedRoleName . includes ( 'copilot' )
1259+ || normalizedRoleName . includes ( 'admin' )
1260+ || normalizedRoleName . includes ( 'manager' )
1261+ } )
1262+ } ,
1263+ [ actionChallengeRole , myResources ] ,
1264+ )
1265+
12281266 const {
12291267 data : challengeReviewsData ,
12301268 error : fetchChallengeReviewsError ,
@@ -1234,7 +1272,7 @@ export function useFetchScreeningReview(): useFetchScreeningReviewProps {
12341272 {
12351273 fetcher : ( ) => fetchChallengeReviews ( challengeId ?? '' ) ,
12361274 isPaused : ( ) => ! challengeId
1237- || ( ! reviewerIds . length && actionChallengeRole !== SUBMITTER ) ,
1275+ || ( ! reviewerIds . length && ! shouldForceReviewFetch ) ,
12381276 } ,
12391277 )
12401278
@@ -1518,6 +1556,7 @@ export function useFetchScreeningReview(): useFetchScreeningReviewProps {
15181556 screeningScorecardId ,
15191557 contestSubmissions ,
15201558 resources ,
1559+ myResources ,
15211560 ] ,
15221561 )
15231562
0 commit comments