Skip to content

Commit

Permalink
Use button label as default for pending button label
Browse files Browse the repository at this point in the history
  • Loading branch information
danielweinmann committed Jul 4, 2023
1 parent 8e42de7 commit 624bfae
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 624bfae

Please sign in to comment.