Fix variant handling in explorer and tablebase#3173
Conversation
|
I think it would be preferable to display the lichess database all the time for variants instead of showing that the master db is not available. |
Agreed. We don't want to be forced to go to settings to change the DB. |
|
Agreed, thanks. I updated the PR so variant positions no longer show the “Masters database is not available” message. Since mobile currently stores a single selected explorer database, the current behavior is now:
This fallback does not change the saved preference; it only affects the database used for the current variant position. Longer term, I agree the better UI would be closer to the LichessWeb, where multiple databases can be shown as separate tabs and unsupported databases can simply be hidden/disabled per variant. That is a larger UI/settings change, so I’d prefer to keep it as a follow-up PR. |
| final Map<OpeningExplorerCacheKey, OpeningExplorerEntry> cache = {}; | ||
| // Variant is part of the key because the same FEN string can be queried | ||
| // against different explorer datasets. | ||
| final Map<({String fen, Variant variant, OpeningExplorerPrefs prefs}), OpeningExplorerEntry> |
There was a problem hiding this comment.
You are now using a record instead of the freezed class, which is fine. But I don't see the deletion of that OpeningExplorerCacheKey class in the PR. I suppose it is now dead code (it should be) so it needs to be removed.
There was a problem hiding this comment.
Done. The unused code has been removed.
Summary
Fix variant handling for opening explorer and tablebase requests. #3168
This PR makes explorer requests variant-aware so non-standard positions no longer fall back to standard data by accident. It also prevents the Masters database from being shown for variants where the endpoint does not support variant selection.
Changes
OpeningExplorerViewandopeningExplorerProvider.variantquery parameter for Lichess and player opening explorer requests.fromPositionmapped tostandard, since it is an imported/custom standard chess position rather than a real variant./mastersendpoint has no variant parameter./standardfor standard, from-position, and Chess960/atomicfor Atomic/antichessfor AntichessScreenshot
Combined screenshot: