File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -687,6 +687,16 @@ class AnalysisController extends AsyncNotifier<AnalysisState>
687687 final pathChange = curState.currentPath != path;
688688 final (currentNode, opening) = _nodeOpeningAt (_root, path);
689689
690+ bool pathWasExpanded = false ;
691+ if (pathChange) {
692+ for (final child in currentNode.children) {
693+ if (child.isCollapsed) {
694+ child.isCollapsed = false ;
695+ pathWasExpanded = true ;
696+ }
697+ }
698+ }
699+
690700 // always show variation if the user plays a move
691701 if (shouldForceShowVariation && currentNode is Branch && currentNode.isCollapsed) {
692702 _root.updateAt (path, (node) {
@@ -697,7 +707,7 @@ class AnalysisController extends AsyncNotifier<AnalysisState>
697707 // root view is only used to display move list, so we need to
698708 // recompute the root view only when the nodelist length changes
699709 // or a variation is hidden/shown
700- final rootView = shouldForceShowVariation || shouldRecomputeRootView
710+ final rootView = shouldForceShowVariation || shouldRecomputeRootView || pathWasExpanded
701711 ? _root.view
702712 : curState.root;
703713
Original file line number Diff line number Diff line change @@ -437,6 +437,16 @@ class StudyController extends AsyncNotifier<StudyState>
437437 final pathChange = state.currentPath != path;
438438 final currentNode = _root.nodeAt (path);
439439
440+ bool pathWasExpanded = false ;
441+ if (pathChange) {
442+ for (final child in currentNode.children) {
443+ if (child.isCollapsed) {
444+ child.isCollapsed = false ;
445+ pathWasExpanded = true ;
446+ }
447+ }
448+ }
449+
440450 // always show variation if the user plays a move
441451 if (shouldForceShowVariation && currentNode is Branch && currentNode.isCollapsed) {
442452 _root.updateAt (path, (node) {
@@ -447,7 +457,9 @@ class StudyController extends AsyncNotifier<StudyState>
447457 // root view is only used to display move list, so we need to
448458 // recompute the root view only when the nodelist length changes
449459 // or a variation is hidden/shown
450- final rootView = shouldForceShowVariation || shouldRecomputeRootView ? _root.view : state.root;
460+ final rootView = shouldForceShowVariation || shouldRecomputeRootView || pathWasExpanded
461+ ? _root.view
462+ : state.root;
451463
452464 final isForward = path.size > state.currentPath.size;
453465 if (currentNode is Branch ) {
You can’t perform that action at this time.
0 commit comments