From cecde39e613d28d65b01982cf1d8dbeb42398580 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Wed, 20 Mar 2024 10:02:19 -0400 Subject: [PATCH] Optimization suggestions Signed-off-by: Ian Bolton --- client/src/app/hooks/useAssessmentStatus.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/app/hooks/useAssessmentStatus.ts b/client/src/app/hooks/useAssessmentStatus.ts index a99a5916ac..df1eea447c 100644 --- a/client/src/app/hooks/useAssessmentStatus.ts +++ b/client/src/app/hooks/useAssessmentStatus.ts @@ -8,6 +8,10 @@ export const useAssessmentStatus = (application: Application) => { const { assessments } = useFetchAssessments(); const { archetypes } = useFetchArchetypes(); + const isDirectlyAssessed = + (application.assessed && (application.assessments?.length ?? 0) > 0) ?? + false; + return useMemo(() => { const applicationAssessments = assessments?.filter( @@ -65,10 +69,6 @@ export const useAssessmentStatus = (application: Application) => { assessment.status === "empty" || assessment.status === "complete" ); - const isDirectlyAssessed = - (application.assessed && (application.assessments?.length ?? 0) > 0) ?? - false; - return { allArchetypesAssessed, countOfFullyAssessedArchetypes: assessedArchetypesCount, @@ -76,5 +76,5 @@ export const useAssessmentStatus = (application: Application) => { hasApplicationAssessmentInProgress, isApplicationDirectlyAssessed: isDirectlyAssessed, }; - }, [assessments, archetypes, application]); + }, [assessments, archetypes, application.id, isDirectlyAssessed]); };