Skip to content

Updates for v1.2.6#68

Merged
ianhalpern merged 5 commits into
masterfrom
releases/v1.2.6
Mar 3, 2025
Merged

Updates for v1.2.6#68
ianhalpern merged 5 commits into
masterfrom
releases/v1.2.6

Conversation

@ianhalpern

@ianhalpern ianhalpern commented Jan 27, 2025

Copy link
Copy Markdown
Collaborator

Description

The main update is to expose the Payload.js Form.submit function. This allows direct control of the form submission trigger. For example:

function Checkout() {
  const formRef = useRef(null);

  const manualFormSubmit = async () => {
    try {
       const result = await formRef.current.submit()
       console.log('SUCCESS', result)
    } catch(e) {
       console.log('ERROR', e.data)
    }
  }

  return <div>
    <PaymentForm ref={formRef}>
      <Card/>
    </PaymentForm>
    <button type="button" onClick={manualFormSubmit}>Submit</button>
  </div>
}

Changes include:

  • Exposed Payload.js Form.submit function
  • Forwarded ref for higher order form components (PaymentForm and PaymentMethodForm)
  • Fixed issue with payment and paymentMethod props not updating on rerender
  • Added docstrings to components and functions
  • Delay initalizePayload until clientToken and Payload.js are present
  • Enable onInvalid/Valid on standard inputs
  • Added docstrings to components and functions

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

- Added docstrings to components and functions
- Exposed PayloadForm.submit function
- Forwarded ref for higher order form components (PaymentForm and
  PaymentMethodForm)
- Fixed issue with payment and paymentMethod props not updating
  on rerender
@ianhalpern ianhalpern merged commit bf62e9a into master Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants