From d2e4be07766ab9671c1740f2427d4c811fa03a20 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 6 May 2022 20:14:04 -0500 Subject: [PATCH] RegistrationForm: fix debounced function, make Submit button actually submit --- .../features/auth_login/components/registration_form.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/soapbox/features/auth_login/components/registration_form.tsx b/app/soapbox/features/auth_login/components/registration_form.tsx index eafbbd9d0..f0d095d49 100644 --- a/app/soapbox/features/auth_login/components/registration_form.tsx +++ b/app/soapbox/features/auth_login/components/registration_form.tsx @@ -1,7 +1,7 @@ import axios from 'axios'; import { Map as ImmutableMap } from 'immutable'; import { debounce } from 'lodash'; -import React, { useState, useRef } from 'react'; +import React, { useState, useRef, useCallback } from 'react'; import { useIntl, FormattedMessage, defineMessages } from 'react-intl'; import { Link, useHistory } from 'react-router-dom'; import { v4 as uuidv4 } from 'uuid'; @@ -155,7 +155,7 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { return params.get('password', '') === passwordConfirmation; }; - const usernameAvailable = debounce(username => { + const usernameAvailable = useCallback(debounce(username => { if (!supportsAccountLookup) return; const source = refreshCancelToken(); @@ -170,7 +170,7 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { } }); - }, 1000, { trailing: true }); + }, 1000, { trailing: true }), []); const onSubmit: React.FormEventHandler = () => { if (!passwordsMatch()) { @@ -348,7 +348,7 @@ const RegistrationForm: React.FC = ({ inviteToken }) => { -