Fix WebLN checkbox unclickable (#1299)

Checkbox was unclickable because wallet.isConfigured is false if wallet.config was null.
This commit is contained in:
ekzyis 2024-08-14 14:29:24 -05:00 committed by GitHub
parent ddb32e0bb7
commit 4000522773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 5 deletions

View File

@ -1,10 +1,9 @@
import { SSR } from '@/lib/constants'
import { useCallback, useState } from 'react'
export default function useLocalState (storageKey, initialValue = '') {
export default function useLocalState (storageKey, defaultValue) {
const [value, innerSetValue] = useState(
initialValue ||
(SSR ? null : JSON.parse(window.localStorage.getItem(storageKey)))
(SSR ? null : JSON.parse(window.localStorage.getItem(storageKey))) || defaultValue
)
const setValue = useCallback((newValue) => {

View File

@ -31,7 +31,7 @@ export default function WalletSettings () {
...acc,
[field.name]: wallet.config?.[field.name] || ''
}
}, wallet.config || {})
}, wallet.config)
// check if wallet uses the form-level validation built into Formik or a Yup schema
const validateProps = typeof wallet.fieldValidation === 'function'

View File

@ -158,7 +158,7 @@ function useConfig (wallet) {
const me = useMe()
const storageKey = getStorageKey(wallet?.name, me)
const [clientConfig, setClientConfig, clearClientConfig] = useClientConfig(storageKey)
const [clientConfig, setClientConfig, clearClientConfig] = useClientConfig(storageKey, {})
const [serverConfig, setServerConfig, clearServerConfig] = useServerConfig(wallet)