Compare commits

...

4 Commits

Author SHA1 Message Date
k00b 5cfefc1ca8 cancelled failed payment if not showing qr 2024-08-26 13:58:37 -05:00
k00b 5ae3084e53 remove defunct chats from footer 2024-08-26 12:59:39 -05:00
ekzyis 48d0cd1086
Fix full config saved on client on priority change (#1329)
* Fix full config saved on client on priority change

* Fix WebLN disabled on priority change

* Always merge configs
2024-08-25 18:40:55 -05:00
ekzyis 203db13553
Fix cost not shown in comment details (#1330) 2024-08-25 18:40:02 -05:00
4 changed files with 20 additions and 10 deletions

View File

@ -87,15 +87,15 @@ const SocialsPopover = (
const ChatPopover = (
<Popover>
<Popover.Body style={{ fontWeight: 500, fontSize: '.9rem' }}>
<a
{/* <a
href='https://tribes.sphinx.chat/t/stackerzchat' className='nav-link p-0 d-inline-flex'
target='_blank' rel='noreferrer'
>
sphinx
</a>
<span className='mx-2 text-muted'> \ </span>
<span className='mx-2 text-muted'> \ </span> */}
<a
href='https://t.me/stackernews' className='nav-link p-0 d-inline-flex'
href='https://t.me/k00bideh' className='nav-link p-0 d-inline-flex'
target='_blank' rel='noreferrer'
>
telegram

View File

@ -1,6 +1,6 @@
import { useApolloClient, useLazyQuery, useMutation } from '@apollo/client'
import { useCallback, useState } from 'react'
import { InvoiceCanceledError, InvoiceExpiredError, useQrPayment, useWalletPayment } from './payment'
import { InvoiceCanceledError, InvoiceExpiredError, useInvoice, useQrPayment, useWalletPayment } from './payment'
import { GET_PAID_ACTION } from '@/fragments/paidAction'
/*
@ -23,6 +23,7 @@ export function usePaidMutation (mutation,
fetchPolicy: 'network-only'
})
const waitForWalletPayment = useWalletPayment()
const invoiceHelper = useInvoice()
const waitForQrPayment = useQrPayment()
const client = useApolloClient()
// innerResult is used to store/control the result of the mutation when innerMutate runs
@ -40,12 +41,14 @@ export function usePaidMutation (mutation,
err instanceof InvoiceExpiredError) {
// bail since qr code payment will also fail
// also bail if the payment took more than 1 second
// and cancel the invoice if it's not already canceled so it can be retried
invoiceHelper.cancel(invoice).catch(console.error)
throw err
}
walletError = err
}
return await waitForQrPayment(invoice, walletError, { persistOnNavigate, waitFor })
}, [waitForWalletPayment, waitForQrPayment])
}, [waitForWalletPayment, waitForQrPayment, invoiceHelper])
const innerMutate = useCallback(async ({
onCompleted: innerOnCompleted, ...innerOptions

View File

@ -40,6 +40,7 @@ export const COMMENT_FIELDS = gql`
actionState
confirmedAt
}
cost
}
`

View File

@ -186,20 +186,23 @@ function useConfig (wallet) {
let valid = true
try {
newClientConfig = await walletValidate(wallet, newClientConfig)
const transformedConfig = await walletValidate(wallet, newClientConfig)
if (transformedConfig) {
newClientConfig = Object.assign(newClientConfig, transformedConfig)
}
} catch {
valid = false
}
if (valid) {
if (priorityOnly) {
setClientConfig(newConfig)
setClientConfig(newClientConfig)
} else {
try {
// XXX: testSendPayment can return a new config (e.g. lnc)
// XXX: testSendPayment can return a new config (e.g. lnc)
const newerConfig = await wallet.testSendPayment?.(newConfig, { me, logger })
if (newerConfig) {
newClientConfig = newerConfig
newClientConfig = Object.assign(newClientConfig, newerConfig)
}
} catch (err) {
logger.error(err.message)
@ -219,7 +222,10 @@ function useConfig (wallet) {
let valid = true
try {
newServerConfig = await walletValidate(wallet, newServerConfig)
const transformedConfig = await walletValidate(wallet, newServerConfig)
if (transformedConfig) {
newServerConfig = Object.assign(newServerConfig, transformedConfig)
}
} catch {
valid = false
}