From d8a4d868908dacbdbe48db75a08077b1657a4d11 Mon Sep 17 00:00:00 2001 From: GuillaumeSD Date: Thu, 9 Jan 2025 00:57:46 +0100 Subject: [PATCH] fix : update savedEval if multiPv changes --- src/sections/analysis/hooks/useCurrentPosition.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sections/analysis/hooks/useCurrentPosition.ts b/src/sections/analysis/hooks/useCurrentPosition.ts index 96447b1..395e97a 100644 --- a/src/sections/analysis/hooks/useCurrentPosition.ts +++ b/src/sections/analysis/hooks/useCurrentPosition.ts @@ -67,9 +67,13 @@ export const useCurrentPosition = (engineName?: EngineName) => { if ( savedEval && savedEval.engine === engineName && - savedEval.lines[0].depth >= depth + (savedEval.lines?.length ?? 0) >= multiPv && + (savedEval.lines[0].depth ?? 0) >= depth ) { - setPartialEval?.(savedEval); + setPartialEval?.({ + ...savedEval, + lines: savedEval.lines.slice(0, multiPv), + }); return savedEval; }