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

[Issue #51]: debounce pagination #53

Merged
merged 10 commits into from
Jun 3, 2024
Merged

Conversation

rylew1
Copy link
Collaborator

@rylew1 rylew1 commented May 25, 2024

Summary

Fixes #51

Time to review: 3 min

Changes proposed

  • Add 500ms debounce on pagination
Screen.Recording.2024-05-24.at.5.12.51.PM.mov

Copy link

github-actions bot commented May 25, 2024

Coverage report for ./frontend

St.
Category Percentage Covered / Total
🟢 Statements 83.27% 846/1016
🟡 Branches 68.31% 222/325
🟡 Functions 75.46% 163/216
🟢 Lines 82.81% 795/960

Test suite run success

168 tests passing in 54 suites.

Report generated by 🧪jest coverage report action from 19cd99d

@rylew1 rylew1 marked this pull request as draft May 25, 2024 00:15
@@ -31,6 +33,10 @@ export default function SearchPagination({
}: SearchPaginationProps) {
const { pending } = useFormStatus();

const debouncedHandlePageChange = useDebouncedCallback((newPage: number) => {
handlePageChange(newPage);
}, DEBOUNCE_TIME);
Copy link
Member

Choose a reason for hiding this comment

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

(just curious) Does this mean there will always be a 500 delay? Even on the first click?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Basically yes - I wanted to have a quick meeting also - that's why this is still in draft.

I also would need to update some of the e2e tests to wait for page change

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good. Let's meet to talk it thru. There might be a different UX we could use — e.g. instead of debouncing, disable the pagination while results are loading.

@rylew1 rylew1 marked this pull request as ready for review May 29, 2024 19:44
@rylew1 rylew1 merged commit 9574e29 into main Jun 3, 2024
11 checks passed
@rylew1 rylew1 deleted the rylew/51-debounce-pagination branch June 3, 2024 21:00
acouch pushed a commit that referenced this pull request Sep 18, 2024
Fixes HHS#2074

- Add 300ms debounce on pagination
acouch pushed a commit that referenced this pull request Sep 18, 2024
Fixes HHS#2074

- Add 300ms debounce on pagination
acouch pushed a commit to HHS/simpler-grants-gov that referenced this pull request Sep 18, 2024
Fixes #2074

- Add 300ms debounce on pagination
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]: Debounce pagination click
2 participants