Skip to content

Commit

Permalink
fix rerender auth signup form
Browse files Browse the repository at this point in the history
  • Loading branch information
fiskus committed Sep 20, 2024
1 parent a9d9e41 commit 23ef84d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions catalog/app/containers/Auth/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ function PasswordSignUp({ mutex, next, onSuccess }) {
const [email, setEmail] = React.useState('')
const [username, setName] = React.useState('')
const onFormChange = React.useCallback(
async ({ values }) => {
if (email !== values.email) setEmail(values.email)
if (username !== values.username) setName(values.username)
async ({ modified, values }) => {
if (modified.email && email !== values.email) setEmail(values.email)
if (modified.username && username !== values.username) setName(values.username)
},
[email, username],
)
Expand Down Expand Up @@ -135,7 +135,10 @@ function PasswordSignUp({ mutex, next, onSuccess }) {
submitting,
}) => (
<form onSubmit={handleSubmit}>
<RF.FormSpy subscription={{ values: true }} onChange={onFormChange} />
<RF.FormSpy
subscription={{ values: true, modified: true }}
onChange={onFormChange}
/>
<RF.Field
component={Layout.Field}
name="username"
Expand Down

0 comments on commit 23ef84d

Please sign in to comment.