Skip to content

Commit

Permalink
Fix formik bag lost
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed Feb 7, 2024
1 parent 19c725e commit cc6c460
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/invoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const useInvoiceable = (onSubmit, options = defaultOptions) => {

const onSubmitWrapper = useCallback(async (
{ cost, ...formValues },
{ variables, optimisticResponse, update, ...apolloArgs }) => {
{ variables, optimisticResponse, update, ...submitArgs }) => {
// some actions require a session
if (!me && options.requireSession) {
throw new Error('you must be logged in')
Expand All @@ -201,7 +201,7 @@ export const useInvoiceable = (onSubmit, options = defaultOptions) => {
try {
const insufficientFunds = me?.privates.sats < cost
return await onSubmit(formValues,
{ variables, optimisticsResponse: insufficientFunds ? null : optimisticResponse, ...apolloArgs })
{ ...submitArgs, variables, optimisticsResponse: insufficientFunds ? null : optimisticResponse })
} catch (error) {
if (!payOrLoginError(error) || !cost) {
// can't handle error here - bail
Expand Down Expand Up @@ -255,7 +255,7 @@ export const useInvoiceable = (onSubmit, options = defaultOptions) => {
const retry = () => onSubmit(
{ hash: inv.hash, hmac: inv.hmac, ...formValues },
// unset update function since we already ran an cache update if we paid using WebLN
{ variables, update: webLn ? null : undefined })
{ ...submitArgs, variables, update: webLn ? null : undefined })
// first retry
try {
const ret = await retry()
Expand Down

0 comments on commit cc6c460

Please sign in to comment.