From 7ec4a25fbfd4af7182c8caecbc7f91540e4fac4c Mon Sep 17 00:00:00 2001 From: StephenHeaps <5314553+StephenHeaps@users.noreply.github.com> Date: Mon, 27 Nov 2023 09:15:11 -0500 Subject: [PATCH] Fix #8462: Custom Networks list not updated when opened via browser settings (#8464) Update chain list when custom networks list is opened to handle case when opened via browser settings. --- Sources/BraveWallet/Crypto/Stores/NetworkStore.swift | 2 +- Sources/BraveWallet/Settings/CustomNetworkListView.swift | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/BraveWallet/Crypto/Stores/NetworkStore.swift b/Sources/BraveWallet/Crypto/Stores/NetworkStore.swift index 9e43747ba90..adca6a2810b 100644 --- a/Sources/BraveWallet/Crypto/Stores/NetworkStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/NetworkStore.swift @@ -167,7 +167,7 @@ public class NetworkStore: ObservableObject, WalletObserverStore { self.isSwapSupported = await swapService.isSwapSupported(chain.chainId) } - @MainActor private func updateChainList() async { + @MainActor func updateChainList() async { // fetch all networks for all coin types self.allChains = await rpcService.allNetworksForSupportedCoins(respectTestnetPreference: false) diff --git a/Sources/BraveWallet/Settings/CustomNetworkListView.swift b/Sources/BraveWallet/Settings/CustomNetworkListView.swift index 4736dcf8d5d..e8c3fcd7a2c 100644 --- a/Sources/BraveWallet/Settings/CustomNetworkListView.swift +++ b/Sources/BraveWallet/Settings/CustomNetworkListView.swift @@ -138,6 +138,9 @@ struct CustomNetworkListView: View { } .navigationViewStyle(StackNavigationViewStyle()) } + .task { + await networkStore.updateChainList() + } } }