Skip to content

Fix last edited PGN header not saved on share (#2850)#2911

Merged
veloce merged 1 commit into
lichess-org:mainfrom
CloudyDino:fix/2850-black-elo-missing-pgn-export
Apr 8, 2026
Merged

Fix last edited PGN header not saved on share (#2850)#2911
veloce merged 1 commit into
lichess-org:mainfrom
CloudyDino:fix/2850-black-elo-missing-pgn-export

Conversation

@CloudyDino

Copy link
Copy Markdown
Contributor

Fixes #2850

Summary

  • When exporting PGN from the analysis board's Share & Export screen, whichever text field was still focused when tapping "Share PGN" would retain its default ? value in the exported PGN. This most commonly affected BlackElo since it's the last rating field.
  • We now explicitly flush all text controller values into state before generating the PGN, making it independent of focus timing.

Changes

  • analysis_share_screen.dart: Iterate through all text controllers and call updatePgnHeader for each before calling makeExportPgn()
  • New test file analysis_share_screen_test.dart: Verifies that the last edited field (BlackElo, WhiteElo) is correctly persisted when sharing without first unfocusing

Test plan

  • Run flutter test test/view/analysis/analysis_share_screen_test.dart
  • Tested manually with different fields to confirm that the fix works.

Flush all text controller values into state before generating the PGN.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

@veloce veloce left a comment

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.

LGTM

@veloce veloce merged commit 5b9c88b into lichess-org:main Apr 8, 2026
1 check passed
@CloudyDino CloudyDino deleted the fix/2850-black-elo-missing-pgn-export branch April 22, 2026 16:54
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.

Black elo missing from Sharing & export PGN from analysis board

2 participants