Fix custom zap modal closed after zap undo

This commit is contained in:
ekzyis 2024-03-24 20:06:05 +01:00
parent 0193ac97fe
commit 42d7a31584
1 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ export default function ItemAct ({ onClose, itemId, down, children }) {
const [act, actUpdate] = useAct()
const onSubmit = useCallback(async ({ amount, hash, hmac }, { update }) => {
const onSubmit = useCallback(async ({ amount, hash, hmac }, { update, keepOpen }) => {
if (!me) {
const storageKey = `TIP-item:${itemId}`
const existingAmount = Number(window.localStorage.getItem(storageKey) || '0')
@ -75,7 +75,7 @@ export default function ItemAct ({ onClose, itemId, down, children }) {
// due to optimistic UX on zap undos
if (!me || !me.privates.zapUndos) await strike()
addCustomTip(Number(amount))
onClose()
if (!keepOpen) onClose()
}, [me, act, down, itemId, strike])
const onSubmitWithUndos = withToastFlow(toaster)(
@ -128,7 +128,7 @@ export default function ItemAct ({ onClose, itemId, down, children }) {
undoUpdate = update()
setTimeout(() => {
if (canceled) return resolve()
onSubmit(values, { flowId, ...args, update: null })
onSubmit(values, { flowId, ...args, update: null, keepOpen: true })
.then(resolve)
.catch((err) => {
undoUpdate()