Skip to content

Commit f879b62

Browse files
committed
Fix draft gone if wallet prompt closed
1 parent 4ab1d46 commit f879b62

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

components/form.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { useShowModal } from './modal'
3939
import dynamic from 'next/dynamic'
4040
import { useIsClient } from './use-client'
4141
import PageLoading from './page-loading'
42+
import { WalletPromptClosed } from '@/wallets/client/hooks'
4243

4344
export class SessionRequiredError extends Error {
4445
constructor () {
@@ -1087,6 +1088,7 @@ export function Form ({
10871088
await onSubmit(values, ...args)
10881089
}
10891090
} catch (err) {
1091+
if (err instanceof WalletPromptClosed) return
10901092
console.log(err.message, err)
10911093
toaster.danger(err.message ?? err.toString?.())
10921094
return

components/use-item-submit.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { RETRY_PAID_ACTION } from '@/fragments/paidAction'
88
import gql from 'graphql-tag'
99
import { USER_ID } from '@/lib/constants'
1010
import { useMe } from './me'
11-
import { useWalletRecvPrompt, WalletPromptClosed } from '@/wallets/client/hooks'
11+
import { useWalletRecvPrompt } from '@/wallets/client/hooks'
1212

1313
// this is intented to be compatible with upsert item mutations
1414
// so that it can be reused for all post types and comments and we don't have
@@ -27,12 +27,7 @@ export default function useItemSubmit (mutation,
2727

2828
return useCallback(
2929
async ({ boost, crosspost, title, options, bounty, status, ...values }, { resetForm }) => {
30-
try {
31-
await walletPrompt()
32-
} catch (err) {
33-
if (err instanceof WalletPromptClosed) return
34-
throw err
35-
}
30+
await walletPrompt()
3631

3732
if (options) {
3833
// remove existing poll options since else they will be appended as duplicates

0 commit comments

Comments
 (0)