From afa1ac74d333f0a2db0469300d50cb18534f8745 Mon Sep 17 00:00:00 2001 From: ice-brontes <187490541+ice-brontes@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:53:49 +0200 Subject: [PATCH] chore: refactored updateNetwork to use useCallback --- .../coin_receive_modal/coin_receive_modal.dart | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart b/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart index 03cc78234..09cefd8d0 100644 --- a/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart +++ b/lib/app/features/wallet/views/pages/coins_flow/coin_receive_modal/coin_receive_modal.dart @@ -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'; @@ -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),