You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The method loadPerAccount has two call sites, i.e. places
where we send register-queue requests:
1. _reloadPerAccount through [UpdateMachine._handlePollError]
2. perAccount through [PerAccountStoreWidget] (the common case)
We utilize the existing [AccountNotFoundException] because
invalidating invalid auth keys effectively logs out the account, that it
can no longer be found in the store. [PerAccountStoreWidget] already
expects this error by ignoring it and waiting for the route to be
removed:
```dart
try {
// If this succeeds, globalStore will notify listeners, and
// [didChangeDependencies] will run again, this time in the
// `store != null` case above.
await globalStore.perAccount(widget.accountId);
} on AccountNotFoundException {
// The account was logged out while its store was loading.
// This widget will be showing [placeholder] perpetually,
// but that's OK as long as other code will be removing it from the UI
// (usually by using [routeToRemoveOnLogout]).
}
```
(included because unchanged code is not in the diff)
To handle 1, we apply the same expectation that the account gets logged
out when the exception happens. For `_handlePollError`, while the store
was not replaced at all, the end result of having the old store disposed
is still expected.
This partly addresses #890 by handling authentication errors for
register-queue.
Fixes: #737
Signed-off-by: Zixuan James Li <[email protected]>
0 commit comments