From 207d7b6b100e9920017859f1fb8a80344b2910d1 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Thu, 3 Aug 2023 16:47:30 -0700 Subject: [PATCH] Fix pipeline performance issue (#1070) --- .../modules/companies/components/HooksCompanyBoard.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/front/src/modules/companies/components/HooksCompanyBoard.tsx b/front/src/modules/companies/components/HooksCompanyBoard.tsx index 8acb76005d..58ca791c63 100644 --- a/front/src/modules/companies/components/HooksCompanyBoard.tsx +++ b/front/src/modules/companies/components/HooksCompanyBoard.tsx @@ -162,10 +162,16 @@ export function HooksCompanyBoard({ ); const synchronizeCompanyProgresses = useRecoilCallback( - ({ set }) => + ({ snapshot, set }) => (companyBoardIndex: { [key: string]: CompanyProgress }) => { Object.entries(companyBoardIndex).forEach(([id, companyProgress]) => { - set(companyProgressesFamilyState(id), companyProgress); + if ( + JSON.stringify( + snapshot.getLoadable(companyProgressesFamilyState(id)).getValue(), + ) !== JSON.stringify(companyProgress) + ) { + set(companyProgressesFamilyState(id), companyProgress); + } }); }, [],