Skip to content

Commit

Permalink
fix: add context mounted checks for async gaps (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-tbd authored Oct 9, 2024
1 parent 8858523 commit bc4c6dc
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 16 deletions.
10 changes: 6 additions & 4 deletions lib/features/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ class HomePage extends HookConsumerWidget {

useEffect(
() {
Future.delayed(
Duration.zero,
() async => _getExchanges(context, ref, exchanges),
);
Future.delayed(Duration.zero, () async {
if (context.mounted) {
await _getExchanges(context, ref, exchanges);
}
});

return null;
},
[],
Expand Down
9 changes: 5 additions & 4 deletions lib/features/kcc/kcc_retrieval_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ class KccRetrievalPage extends HookConsumerWidget {

useEffect(
() {
Future.delayed(
Duration.zero,
() async => _pollForCredential(context, ref, credential),
);
Future.delayed(Duration.zero, () async {
if (context.mounted) {
await _pollForCredential(context, ref, credential);
}
});

return null;
},
Expand Down
10 changes: 6 additions & 4 deletions lib/features/kcc/kcc_webview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ class KccWebviewPage extends HookConsumerWidget {

useEffect(
() {
Future.delayed(
Duration.zero,
() async => _loadWebView(context, ref, idvRequest, webViewController),
);
Future.delayed(Duration.zero, () async {
if (context.mounted) {
await _loadWebView(context, ref, idvRequest, webViewController);
}
});

return null;
},
[],
Expand Down
10 changes: 6 additions & 4 deletions lib/features/payment/payment_amount_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ class PaymentAmountPage extends HookConsumerWidget {

useEffect(
() {
Future.delayed(
Duration.zero,
() => _getOfferings(context, ref, dapState?.currencies, offerings),
);
Future.delayed(Duration.zero, () async {
if (context.mounted) {
await _getOfferings(context, ref, dapState?.currencies, offerings);
}
});

return null;
},
[],
Expand Down

0 comments on commit bc4c6dc

Please sign in to comment.