Skip to content

automatically expand the current children node#3185

Open
HaonRekcef wants to merge 1 commit into
lichess-org:mainfrom
HaonRekcef:fix-notation-expand
Open

automatically expand the current children node#3185
HaonRekcef wants to merge 1 commit into
lichess-org:mainfrom
HaonRekcef:fix-notation-expand

Conversation

@HaonRekcef
Copy link
Copy Markdown
Collaborator

Automatically expand the children of the currentNode, closes #2494

The perf impact is negligible, as only the current children get looped.

Screencast_20260514_173011.webm

I implemented for studies and analysis, I do not see a reason to do it for broadcasts.

Copy link
Copy Markdown
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok in principle for the feature and implementation.

But see comment: it should only be applied if not fast seeking the game.

Also since the asked change would complexity a bit the logic I'd like to have 2 simples tests for this: one that shows it does not expand when fast seeking, and one that shows it does for simple move jump.

Thanks!

// recompute the root view only when the nodelist length changes
// or a variation is hidden/shown
final rootView = shouldForceShowVariation || shouldRecomputeRootView
final rootView = shouldForceShowVariation || shouldRecomputeRootView || pathWasExpanded
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recomputing rootView is expensive. Are you sure about the performance implications? Seems like it would impact the fast forward/rewind feature.

IMO this should be disabled if fast forward/rewind and only apply to a single jump.

@HaonRekcef
Copy link
Copy Markdown
Collaborator Author

I found two cases where nodes are automatically collapsed:

isCollapsed: frame.nesting > 2 || hideVariations && childIdx > 0,

and
isCollapsed: children.length > 1,

So I am wondering if we need the fast-forward logic:
As for the first case the collapsed nodes are not direct children of the mainline and fast-forwarding a variation with a lot of sub-variations seems very rare.

It might be a problem for the second case, as direct children of the mainline nodes are collapsed. But this is actually very niche: people requesting a server analysis and then long-pressing through it. A game that is reopened would not have them collapsed because it would use the logic from the first case. Also a normal game would be very light to compute the rootView for, as it barely has variations.

So the one possible problem I can see is for huge studies. After requesting a computer analysis, those lines are collapsed and then the user fast-navigates through the moves, rootView would need to be recomputed every time.

The only other possibility where this problem appears is when a user manually collapses a lot of variations in a huge study, but tbh this also seems very unlikely.

I think these cases are too rare to deserve their own handling logic in the code. What do you think, @veloce?

@HaonRekcef HaonRekcef force-pushed the fix-notation-expand branch from 94dd1c3 to 02cd011 Compare May 25, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand plus button as you go through moves

2 participants