resetForSession method

  1. @override
Future<void> resetForSession()

Drops every row of the previous session, then refetches the list when one had been read (see SessionScoped).

Clears BEFORE refetching, so a failed refetch leaves the screens empty rather than populated with the previous user's conversations.

Implementation

@override
Future<void> resetForSession() async {
  _sessionGeneration++;

  final hadList = _listStatus != MagicStarterSupportReadStatus.idle;

  _conversations = const [];
  _conversation = null;
  _articleSuggestions = const [];
  _listStatus = MagicStarterSupportReadStatus.idle;
  _threadStatus = MagicStarterSupportReadStatus.idle;
  _listPage = 0;
  _listLastPage = 0;
  _writeError = null;
  _isSubmitting = false;
  _isLoadingMore = false;
  clearErrors();
  refreshUI();

  if (hadList) await loadConversations();
}