From 93a322c816e976de388316bcdf93afebe6e7b2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Correia?= <101414931+0lione@users.noreply.github.com> Date: Mon, 5 Aug 2024 09:58:34 +0100 Subject: [PATCH] fix: React hook dependency error (#1829) --- .../src/ui/Pages/CommitInfo/CommitInfoPage.tsx | 8 +------- .../src/ui/components/CommitInfo/CommitInfo.test.tsx | 6 +++--- .../src/ui/components/CommitInfo/CommitInfo.tsx | 4 +--- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/services/frontend-service/src/ui/Pages/CommitInfo/CommitInfoPage.tsx b/services/frontend-service/src/ui/Pages/CommitInfo/CommitInfoPage.tsx index 2010664e9..373d04311 100644 --- a/services/frontend-service/src/ui/Pages/CommitInfo/CommitInfoPage.tsx +++ b/services/frontend-service/src/ui/Pages/CommitInfo/CommitInfoPage.tsx @@ -81,12 +81,6 @@ export const CommitInfoPage: React.FC = () => { ); case CommitInfoState.READY: - return ( - - ); + return ; } }; diff --git a/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.test.tsx b/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.test.tsx index 0d435f2ff..4bf5b9d12 100644 --- a/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.test.tsx +++ b/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.test.tsx @@ -21,7 +21,7 @@ import { GetCommitInfoResponse, LockPreventedDeploymentEvent_LockType } from '.. test('CommitInfo component does not render commit info when the response is undefined', () => { const { container } = render( - + ); expect(container.textContent).toContain('Backend returned empty response'); @@ -260,7 +260,7 @@ test('CommitInfo component renders commit info when the response is valid', () = ); const { container } = render( - + ); @@ -450,7 +450,7 @@ describe('CommitInfo component renders next and previous buttons correctly', () it(testCase.name, () => { const { container } = render( - + ); diff --git a/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.tsx b/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.tsx index ac75fac61..001987a74 100644 --- a/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.tsx +++ b/services/frontend-service/src/ui/components/CommitInfo/CommitInfo.tsx @@ -19,18 +19,16 @@ import { GetCommitInfoResponse, Event, LockPreventedDeploymentEvent_LockType } f type CommitInfoProps = { commitInfo: GetCommitInfoResponse | undefined; triggerLoadMore: { (): void } | null; - pageNumber: number; }; export const CommitInfo: React.FC = (props) => { const commitInfo = props.commitInfo; const triggerLoadMore: () => void = props.triggerLoadMore !== null ? props.triggerLoadMore : (): void => {}; const canLoadMore = props.commitInfo?.loadMore; - const pageNumber = props.pageNumber; const onClick = useCallback(() => { triggerLoadMore(); - }, [pageNumber, triggerLoadMore]); + }, [triggerLoadMore]); if (commitInfo === undefined) { return (