Skip to content

Commit

Permalink
chore: refactored updateNetwork to use useCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-brontes committed Jan 7, 2025
1 parent 4fb721e commit afa1ac7
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: ice License 1.0

import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ion/app/components/list_item/list_item.dart';
import 'package:ion/app/components/screen_offset/screen_bottom_offset.dart';
Expand All @@ -25,10 +26,13 @@ class CoinReceiveModal extends HookConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final receiveCoinState = ref.watch(receiveCoinsFormControllerProvider);

void updateNetwork(NetworkType network) {
final clarifiedNetwork = network == NetworkType.all ? NetworkType.arbitrum : network;
ref.read(receiveCoinsFormControllerProvider.notifier).setNetwork(clarifiedNetwork);
}
final updateNetwork = useCallback(
(NetworkType network) {
final clarifiedNetwork = network == NetworkType.all ? NetworkType.arbitrum : network;
ref.read(receiveCoinsFormControllerProvider.notifier).setNetwork(clarifiedNetwork);
},
[],
);

useOnInit(
() => updateNetwork(receiveCoinState.selectedNetwork),
Expand Down

0 comments on commit afa1ac7

Please sign in to comment.