fix: clear season flow when starting Classic so tutorial/theme can't leak
- Add SeasonFlowNotifier.clear() to null out the flow state - Call clear() in HomeScreen's Classic button before startStage() - Broaden tutorial-end guard to next.phase != GamePhase.playing (covers stuck) - Add regression test: clear() resets flow to null Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -77,4 +77,20 @@ void main() {
|
||||
expect(container.read(seasonFlowProvider)!.hasNext, isFalse);
|
||||
expect(container.read(gameSessionProvider)!.phase, GamePhase.playing);
|
||||
});
|
||||
|
||||
test('clear() resets flow to null so Classic mode has no stale season context',
|
||||
() async {
|
||||
final container = await _container();
|
||||
final flow = container.read(seasonFlowProvider.notifier);
|
||||
flow.startSeasonStage(_pack(), 0);
|
||||
|
||||
// State is non-null after starting a season stage.
|
||||
expect(container.read(seasonFlowProvider), isNotNull);
|
||||
|
||||
flow.clear();
|
||||
|
||||
// After clear(), the flow must be null so GameScreen's tutorial/theme
|
||||
// checks can't fire for a Classic (endless) session.
|
||||
expect(container.read(seasonFlowProvider), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user