0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-09 22:22:41 +00:00

"Rename searchButtonRef to submitButtonRef and update references"

This commit is contained in:
Víctor Losada Hernández
2024-09-01 11:19:00 +02:00
parent 3fc2e5202e
commit b6e904c9c8

View File

@@ -32,7 +32,7 @@ const VaultPage = (props) => {
const countRef = useRef(null); const countRef = useRef(null);
const v3Ref = useRef(null); const v3Ref = useRef(null);
const legacyRef = useRef(null); const legacyRef = useRef(null);
const searchButtonRef = useRef(null); const submitButtonRef = useRef(null);
useEffect(() => { useEffect(() => {
disableSubmitIfFormInvalid(); disableSubmitIfFormInvalid();
@@ -183,11 +183,8 @@ const VaultPage = (props) => {
pattern=".{3,}" pattern=".{3,}"
title="At least 3 characters" title="At least 3 characters"
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter') { if (e.key === 'Enter' && !submitButtonRef.current.disabled)
if (!searchButtonRef.current.disabled) { loadPage(1, true, true);
loadPage(1, true, true);
}
}
}} }}
placeholder="v3 Reference Document" placeholder="v3 Reference Document"
/> />
@@ -203,11 +200,8 @@ const VaultPage = (props) => {
defaultValue={author} defaultValue={author}
onKeyUp={disableSubmitIfFormInvalid} onKeyUp={disableSubmitIfFormInvalid}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter') { if (e.key === 'Enter' && !submitButtonRef.current.disabled)
if (!searchButtonRef.current.disabled) { loadPage(1, true, true);
loadPage(1, true, true);
}
}
}} }}
placeholder="Gazook89" placeholder="Gazook89"
/> />
@@ -247,7 +241,7 @@ const VaultPage = (props) => {
<button <button
id="searchButton" id="searchButton"
ref={searchButtonRef} ref={submitButtonRef}
onClick={() => { onClick={() => {
loadPage(1, true, true); loadPage(1, true, true);
}} }}