0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 19:12:41 +00:00

Remove unused update in loadPage

Now `update` is unused; can remove that parameter.
This commit is contained in:
Trevor Buckner
2024-09-04 00:20:18 -04:00
parent cd3e517b03
commit a7cb73b02e

View File

@@ -34,7 +34,7 @@ const VaultPage = (props) => {
useEffect(() => { useEffect(() => {
disableSubmitIfFormInvalid(); disableSubmitIfFormInvalid();
loadPage(pageState, false, true); loadPage(pageState, true);
}, []); }, []);
const updateStateWithBrews = (brews, page) => { const updateStateWithBrews = (brews, page) => {
@@ -96,7 +96,7 @@ const VaultPage = (props) => {
} }
}; };
const loadPage = async (page, update, total) => { const loadPage = async (page, updateTotal) => {
if (!validateForm()) { if (!validateForm()) {
return; return;
} }
@@ -112,9 +112,8 @@ const VaultPage = (props) => {
// Perform search with the latest input values, because state is not fast enough // Perform search with the latest input values, because state is not fast enough
performSearch({ titleValue, authorValue, countValue, v3Value, legacyValue, page }); performSearch({ titleValue, authorValue, countValue, v3Value, legacyValue, page });
if (total) { if (updateTotal)
loadTotal({ titleValue, authorValue, v3Value, legacyValue }); loadTotal({ titleValue, authorValue, v3Value, legacyValue });
}
}; };
const renderNavItems = () => ( const renderNavItems = () => (
@@ -165,7 +164,7 @@ const VaultPage = (props) => {
title="At least 3 characters" title="At least 3 characters"
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' && !submitButtonRef.current.disabled) if (e.key === 'Enter' && !submitButtonRef.current.disabled)
loadPage(1, true, true); loadPage(1, true);
}} }}
placeholder="v3 Reference Document" placeholder="v3 Reference Document"
/> />
@@ -182,7 +181,7 @@ const VaultPage = (props) => {
onKeyUp={disableSubmitIfFormInvalid} onKeyUp={disableSubmitIfFormInvalid}
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' && !submitButtonRef.current.disabled) if (e.key === 'Enter' && !submitButtonRef.current.disabled)
loadPage(1, true, true); loadPage(1, true);
}} }}
placeholder="Username" placeholder="Username"
/> />
@@ -224,7 +223,7 @@ const VaultPage = (props) => {
id="searchButton" id="searchButton"
ref={submitButtonRef} ref={submitButtonRef}
onClick={() => { onClick={() => {
loadPage(1, true, true); loadPage(1, true);
}} }}
> >
Search Search
@@ -287,7 +286,7 @@ const VaultPage = (props) => {
className={`pageNumber ${ className={`pageNumber ${
pageState === startPage + index ? 'currentPage' : '' pageState === startPage + index ? 'currentPage' : ''
}`} }`}
onClick={() => loadPage(startPage + index, false, false)} onClick={() => loadPage(startPage + index, false)}
> >
{startPage + index} {startPage + index}
</a> </a>
@@ -297,7 +296,7 @@ const VaultPage = (props) => {
<div className="paginationControls"> <div className="paginationControls">
<button <button
className="previousPage" className="previousPage"
onClick={() => loadPage(pageState - 1, false, false)} onClick={() => loadPage(pageState - 1, false)}
disabled={pageState === startPage} disabled={pageState === startPage}
> >
<i className="fa-solid fa-chevron-left"></i> <i className="fa-solid fa-chevron-left"></i>
@@ -306,7 +305,7 @@ const VaultPage = (props) => {
{startPage > 1 && ( {startPage > 1 && (
<a <a
className="pageNumber firstPage" className="pageNumber firstPage"
onClick={() => loadPage(1, false, false)} onClick={() => loadPage(1, false)}
> >
1 ... 1 ...
</a> </a>
@@ -315,7 +314,7 @@ const VaultPage = (props) => {
{endPage < totalPages && ( {endPage < totalPages && (
<a <a
className="pageNumber lastPage" className="pageNumber lastPage"
onClick={() => loadPage(totalPages, false, false)} onClick={() => loadPage(totalPages, false)}
> >
... {totalPages} ... {totalPages}
</a> </a>
@@ -323,7 +322,7 @@ const VaultPage = (props) => {
</ol> </ol>
<button <button
className="nextPage" className="nextPage"
onClick={() => loadPage(pageState + 1, false, false)} onClick={() => loadPage(pageState + 1, false)}
disabled={pageState === totalPages} disabled={pageState === totalPages}
> >
<i className="fa-solid fa-chevron-right"></i> <i className="fa-solid fa-chevron-right"></i>