Skip to content

Conversation

@hentrymartin
Copy link
Collaborator

@hentrymartin hentrymartin commented Dec 10, 2025

Related JIRA Ticket:

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

What's in this PR?

  • Refetch appeals once appeal response is added/updated
  • When "Response to appeals" button is pressed by default open with edit mode.

@hentrymartin hentrymartin marked this pull request as draft December 10, 2025 22:01
: `/${match[1]}/${match[2]}`

return `${basePath}/reviews/${submissionId}?reviewId=${encodedReviewId}`
return `${basePath}/reviews/${submissionId}?reviewId=${encodedReviewId}&respondToAppeals=true`

Choose a reason for hiding this comment

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

[❗❗ correctness]
Adding &respondToAppeals=true to the query string changes the behavior of the route. Ensure that this change is intentional and that all parts of the application relying on this route are updated accordingly. If this parameter is optional, consider making it conditional to avoid potential issues with existing functionality.

const ReviewViewer: FC = () => {
const navigate = useAppNavigate()
const [searchParams] = useSearchParams()
const [respondToAppeals, setRespondToAppeals] = useState(searchParams.get("respondToAppeals") === 'true')

Choose a reason for hiding this comment

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

[⚠️ correctness]
Using searchParams.get("respondToAppeals") === 'true' directly in the useState initializer can lead to unexpected behavior if the searchParams change after the component mounts. Consider using a useEffect to update respondToAppeals whenever searchParams change.

setRespondToAppeals(false)
}
}, [canEditScorecard, isManagerEdit])
}, [canEditScorecard, isManagerEdit, respondToAppeals])

Choose a reason for hiding this comment

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

[❗❗ correctness]
The dependency array for this useEffect includes respondToAppeals, which is being set within the effect itself. This can lead to an infinite loop if not handled carefully. Ensure that the logic inside the effect does not inadvertently cause repeated state updates.

@hentrymartin hentrymartin changed the title Pm 3141 1 fix(PM-3141): Respond to appeals Dec 10, 2025
try {
if (resourceId) {
// re-fetch appeals for this resourceId
mutate(`EnvironmentConfig.API.V6/appeals/resourceId/${resourceId}`)

Choose a reason for hiding this comment

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

[⚠️ correctness]
The mutate function call has been simplified by removing the second and third arguments. This change means that the cache will not be updated optimistically, and the mutate function will not be called with revalidate set to false. Ensure this change is intentional and that the application logic does not rely on the previous behavior of optimistic updates or preventing revalidation.

// re-fetch appeals for this resourceId
mutate(`EnvironmentConfig.API.V6/appeals/resourceId/${resourceId}`)

}

Choose a reason for hiding this comment

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

[💡 style]
The removal of trailing whitespace on this line is a minor stylistic change. While it does not affect functionality, ensuring no trailing whitespace can help maintain a clean codebase.

@hentrymartin hentrymartin marked this pull request as ready for review December 11, 2025 09:36
@kkartunov kkartunov merged commit 1b0df87 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