-
Notifications
You must be signed in to change notification settings - Fork 38
[Issue #1485] return last page of search if requested page is out of bounds #3796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
useEffect(() => { | ||
console.error(error); | ||
}, [error]); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how this came back, and the above change I think I also handled in a previous PR 🤷
67a3a0a
to
7b7957a
Compare
const t = await getTranslations("Search"); | ||
|
||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where this is being done is more or less arbitrary since the same promise is being awaited in multiple components. That seems weird, which is one of the reasons I did the refactor in #3796
7b7957a
to
f520216
Compare
body: "<li>Check any terms you've entered for typos</li><li>Try different keywords</li><li>Make sure you've selected the right statuses</li><li>Try resetting filters or selecting fewer options</li>", | ||
paginationError: | ||
"You're trying to access opportunity results that are beyond the last page of data.", | ||
noResultsTitle: "Your search did not return any results.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just updating the names here as they were confusing me when working with this component
fcf6dfe
to
7d7d728
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏿
…bounds * updates page query param in url if requested page exceeds total number of pages * removes remnants of previous "maxPageError"
79c4554
to
d2519bc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Summary
Fixes #1485
Time to review: 15 mins
Changes proposed
If the page of search results requested exceeds the total number of pages returned by the API, this updates the page query param to the last page of results, triggering a new search request.
Includes removal of some leftovers from the previous "maxPageError" implementation, and cleans up a couple other things too.
Worth noting that I tried solving this on the API side first, which you can see in 423d730. The issue with that is that there was no easy way to update the url to reflect the change, which seemed bad.
Context for reviewers
Test steps
npm run dev
on this branchAdditional information