Fix WebLN checkbox unclickable (#1299)
Checkbox was unclickable because wallet.isConfigured is false if wallet.config was null.
This commit is contained in:
parent
ddb32e0bb7
commit
4000522773
|
@ -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) => {
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue