From 8acf74c7870c33b1dc6779029d81630faa16db3a Mon Sep 17 00:00:00 2001 From: ekzyis Date: Fri, 5 Jul 2024 19:17:28 +0200 Subject: [PATCH] Fix autowithdrawSettings not applied Form requires config in flat format but mutation requires autowithdraw settings in a separate 'settings' field. I have decided that config will be in flat form format. It will be transformed into mutation format during save. --- pages/settings/wallets/[wallet].js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pages/settings/wallets/[wallet].js b/pages/settings/wallets/[wallet].js index 8cbf4804..27a90ef0 100644 --- a/pages/settings/wallets/[wallet].js +++ b/pages/settings/wallets/[wallet].js @@ -22,11 +22,14 @@ export default function WalletSettings () { const wallet = useWallet(name) const initial = wallet.fields.reduce((acc, field) => { + // we still need to run over all wallet fields via reduce + // even though we use wallet.config as the initial value + // since wallet.config is empty when wallet is not configured return { ...acc, [field.name]: wallet.config?.[field.name] || '' } - }, wallet.server ? wallet.config.autowithdrawSettings : {}) + }, wallet.config) return (