Skip to content

Commit

Permalink
Don't reload the profile when the profile has been closed (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
JAicewizard committed Aug 17, 2024
1 parent ddbd8ad commit 265f72b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/ui/screens/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,11 @@ class _AvatarViewDialogState extends State<AvatarViewDialog> {
// want to allow the user to update multiple
// fields. As long as that isn't the case, we
// also need to reload the MemberCubit below.
await widget.memberCubit.load(widget.member.pk);
if (!widget.memberCubit.isClosed) {
// It is possible the widget has been disposed, closing the memberCubit.
// Hence we only do this if it is not already closed.
await widget.memberCubit.load(widget.member.pk);
}
messenger.hideCurrentSnackBar();
} on ApiException {
messenger.hideCurrentSnackBar();
Expand Down Expand Up @@ -668,7 +672,11 @@ class _AvatarViewDialogState extends State<AvatarViewDialog> {
// want to allow the user to update multiple
// fields. As long as that isn't the case, we
// also need to reload the MemberCubit below.
await widget.memberCubit.load(widget.member.pk);
if (!widget.memberCubit.isClosed) {
// It is possible the widget has been disposed, closing the memberCubit.
// Hence we only do this if it is not already closed.
await widget.memberCubit.load(widget.member.pk);
}
messenger.hideCurrentSnackBar();
} on ApiException {
messenger.hideCurrentSnackBar();
Expand Down

0 comments on commit 265f72b

Please sign in to comment.