Skip to content

Commit

Permalink
Merge branch 'main' into AN/fix-ui-entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-nour-fdc authored Aug 5, 2024
2 parents c4b1de6 + 93a322c commit 220286d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ export const CommitInfoPage: React.FC = () => {
</div>
);
case CommitInfoState.READY:
return (
<CommitInfo
commitInfo={commitInfo.response}
triggerLoadMore={triggerLoadMore}
pageNumber={pageNumber}
/>
);
return <CommitInfo commitInfo={commitInfo.response} triggerLoadMore={triggerLoadMore} />;
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<MemoryRouter>
<CommitInfo commitInfo={undefined} triggerLoadMore={null} pageNumber={0} />
<CommitInfo commitInfo={undefined} triggerLoadMore={null} />
</MemoryRouter>
);
expect(container.textContent).toContain('Backend returned empty response');
Expand Down Expand Up @@ -260,7 +260,7 @@ test('CommitInfo component renders commit info when the response is valid', () =
);
const { container } = render(
<MemoryRouter>
<CommitInfo commitInfo={testCase.commitInfo} triggerLoadMore={null} pageNumber={0} />
<CommitInfo commitInfo={testCase.commitInfo} triggerLoadMore={null} />
</MemoryRouter>
);

Expand Down Expand Up @@ -450,7 +450,7 @@ describe('CommitInfo component renders next and previous buttons correctly', ()
it(testCase.name, () => {
const { container } = render(
<MemoryRouter>
<CommitInfo commitInfo={testCase.commitInfo} triggerLoadMore={null} pageNumber={0} />
<CommitInfo commitInfo={testCase.commitInfo} triggerLoadMore={null} />
</MemoryRouter>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CommitInfoProps> = (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 (
Expand Down

0 comments on commit 220286d

Please sign in to comment.