Skip to content

Commit

Permalink
refresh proposal rubric answers when evaluation id changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcasey committed Jan 9, 2025
1 parent fddec73 commit b86d9a3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export function RubricEvaluation({ proposal, isCurrent, evaluation, refreshPropo
const rubricCriteria = evaluation?.rubricCriteria;
const myRubricAnswers = useMemo(
() => evaluation?.rubricAnswers.filter((answer) => answer.userId === user?.id) || [],
[user?.id, !!evaluation?.rubricAnswers]
// watch the evaluation id in case more than one evaluation has answers
[user?.id, evaluation.id, !!evaluation?.rubricAnswers]

Check warning on line 31 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Test apps

React Hook useMemo has a missing dependency: 'evaluation?.rubricAnswers'. Either include it or remove the dependency array

Check warning on line 31 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Test apps

React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked

Check warning on line 31 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Validate code

React Hook useMemo has a missing dependency: 'evaluation?.rubricAnswers'. Either include it or remove the dependency array

Check warning on line 31 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Validate code

React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked
);
const myDraftRubricAnswers = useMemo(
() => evaluation?.draftRubricAnswers.filter((answer) => answer.userId === user?.id),
// watch the size of draft answers so they refresh when the user deletes them
[user?.id, !!evaluation?.draftRubricAnswers?.length]
[user?.id, evaluation.id, !!evaluation?.draftRubricAnswers?.length]

Check warning on line 36 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Test apps

React Hook useMemo has a missing dependency: 'evaluation?.draftRubricAnswers'. Either include it or remove the dependency array

Check warning on line 36 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Test apps

React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked

Check warning on line 36 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Validate code

React Hook useMemo has a missing dependency: 'evaluation?.draftRubricAnswers'. Either include it or remove the dependency array

Check warning on line 36 in components/proposals/ProposalPage/components/ProposalEvaluations/components/Review/components/RubricEvaluation/RubricEvaluation.tsx

View workflow job for this annotation

GitHub Actions / Validate code

React Hook useMemo has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked
);

const isAuthor = proposal.authors.some((a) => a.userId === user?.id);
Expand Down

0 comments on commit b86d9a3

Please sign in to comment.