Skip to content

Commit

Permalink
Merge pull request #207 from seasonedcc/pending-button-label
Browse files Browse the repository at this point in the history
Use button label as default for pending button label
  • Loading branch information
danielweinmann authored Jul 4, 2023
2 parents 8e42de7 + 624bfae commit fd90d28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/remix-forms/src/createForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function createForm({
radioWrapperComponent,
buttonComponent: Button = 'button',
buttonLabel: rawButtonLabel = 'OK',
pendingButtonLabel = 'OK',
pendingButtonLabel,
method = 'POST',
schema,
beforeChildren,
Expand Down Expand Up @@ -412,7 +412,9 @@ function createForm({
)

const buttonLabel =
transition.state !== 'idle' ? pendingButtonLabel : rawButtonLabel
transition.state !== 'idle'
? pendingButtonLabel ?? rawButtonLabel
: rawButtonLabel

const [disabled, setDisabled] = React.useState(false)

Expand Down

0 comments on commit fd90d28

Please sign in to comment.