Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

[Issue #174] Hide pagination component if no results are found #175

Merged
merged 10 commits into from
Aug 27, 2024

Conversation

btabaska
Copy link
Collaborator

@btabaska btabaska commented Aug 8, 2024

Summary

Fixes #174

Time to review: 8 mins

Changes proposed

Updated pagination component to hide if there are no results. Previously it would show 7 pages that you could navigate between, all with no results.

Context for reviewers

Updated all unit tests for pagination component. They were broken and commented out previously.

Additional information

2024-08-08 15 45 10

@acouch
Copy link
Member

acouch commented Aug 12, 2024

@btabaska , great catch!

Copy link

github-actions bot commented Aug 23, 2024

Coverage report for ./frontend

St.
Category Percentage Covered / Total
🟢 Statements 90.06% 707/785
🟡 Branches
71.33% (+0.1% 🔼)
204/286
🟢 Functions 86.31% 145/168
🟢 Lines 90.75% 667/735

Test suite run success

155 tests passing in 47 suites.

Report generated by 🧪jest coverage report action from d06a241

// PaginationPosition,
// } from "../../../src/components/search/SearchPagination";

// import { render } from "@testing-library/react";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏🏿

*for removing commented out code

@@ -35,24 +35,28 @@ export default function SearchPagination({
const pages = total || Number(totalPages);

const updatePage = (page: number) => {
console.log("here");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this got left here:

Suggested change
console.log("here");

Copy link
Collaborator Author

@btabaska btabaska Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch. This should have been caught by linting. Filing a ticket to add no-console-statement to Eslint config

updateTotalPages(String(total));
updateTotalResults(totalResults);
updateQueryParams(String(page), "page", query, scroll);
console.log("here2");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too

Suggested change
console.log("here2");

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, created. #181 to add no-console to eslint

@acouch
Copy link
Member

acouch commented Aug 26, 2024

@btabaska I found that if I click on the pager first, it doesn't disappear. Maybe if the page it is zero it should check and remove existing pagers, or we could just ignore this as it is not likely to happen often.

Screenshare.-.2024-08-26.5_23_14.PM.mp4

@btabaska btabaska merged commit de661aa into main Aug 27, 2024
12 checks passed
@btabaska btabaska deleted the btabaska/174-hide-pagination-when-no-results branch August 27, 2024 13:38
acouch pushed a commit that referenced this pull request Sep 18, 2024
)

Fixes HHS#2040

> Updated pagination component to hide if there are no results.
Previously it would show 7 pages that you could navigate between, all
with no results.

Updated all unit tests for pagination component. They were broken and
commented out previously.

![2024-08-08 15 45
10](https://github.com/user-attachments/assets/27e8dc6a-dddd-4c52-8086-4cd4579d73fe)
acouch pushed a commit that referenced this pull request Sep 18, 2024
)

Fixes HHS#2040

> Updated pagination component to hide if there are no results.
Previously it would show 7 pages that you could navigate between, all
with no results.

Updated all unit tests for pagination component. They were broken and
commented out previously.

![2024-08-08 15 45
10](https://github.com/user-attachments/assets/27e8dc6a-dddd-4c52-8086-4cd4579d73fe)
acouch pushed a commit to HHS/simpler-grants-gov that referenced this pull request Sep 18, 2024
…pbc#175)

Fixes #2040

> Updated pagination component to hide if there are no results.
Previously it would show 7 pages that you could navigate between, all
with no results.

Updated all unit tests for pagination component. They were broken and
commented out previously.

![2024-08-08 15 45
10](https://github.com/user-attachments/assets/27e8dc6a-dddd-4c52-8086-4cd4579d73fe)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Hide pagination component if there are no search results
2 participants