Skip to content

Commit 0c3fa95

Browse files
fix: analysis controller was stealing stockfish from bg analysis
Root cause: useAnalysisController's useEngineAnalysis hook auto-runs stockfish on every currentNode change. During drill play, each move synced the node to the analysis controller, which called stockfish.streamEvaluations() — killing the background analysis's in-progress evaluation (the new call's stopEvaluation() terminates the old generator). Fix: only sync currentNode to the analysis controller when analysis is actually active (post-drill continue-analyzing mode), not during active drill play. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ad11b16 commit 0c3fa95

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/pages/openings/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,23 @@ const OpeningsPage: NextPage = () => {
182182
false, // Disable auto-saving on openings page
183183
)
184184

185-
// Sync analysis controller with current node
185+
// Sync analysis controller with current node — only when analysis is active
186+
// (post-drill continue-analyzing mode). During drill play, the analysis
187+
// controller's auto-stockfish would conflict with background analysis.
186188
useEffect(() => {
187-
if (controller.currentNode && analysisController.setCurrentNode) {
189+
if (
190+
controller.currentNode &&
191+
analysisController.setCurrentNode &&
192+
(controller.analysisEnabled || controller.continueAnalyzingMode)
193+
) {
188194
analysisController.setCurrentNode(controller.currentNode)
189195
}
190-
}, [controller.currentNode, analysisController.setCurrentNode])
196+
}, [
197+
controller.currentNode,
198+
controller.analysisEnabled,
199+
controller.continueAnalyzingMode,
200+
analysisController.setCurrentNode,
201+
])
191202

192203
// Create game object for MovesContainer
193204
const gameForContainer = useMemo(() => {

0 commit comments

Comments
 (0)