121 add pagination to mymatches #122
Merged
+753
−203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Backend
myMatches(userId, sort, limit, offset)query that returns one page of the user's matched plants andtotalCount, sorted by newest (default), oldest, or name A–Z / Z–A. Newest and oldest use the order ofmatchedPlantIds, so no date is needed.matchedPlantsonUserwithmatchedPlantIds, so only the ids are sent with the user instead of the whole plants with images. Plants that no longer exist are left out and not counted.Frontend
matchedPlantIds. Explore Plants uses them to show whether a plant is matched.MY_MATCHESquery, which is refetched when a match is added or removed and every time the page is opened.SortMenuabove the plants, andPaginationbelow. If the last plant on a page is removed, the page goes back to the last page with plants.useMyMatchesParams. The URL logic is shared withuseExploreParamsthrough a newuseUrlParamshook.Tests
myMatchessorting, pagination, deleted plants and unknown users, and the tests updated tomatchedPlantIds(100 % coverage).myMatchessorting, pagination and empty pages, and the match tests updated tomatchedPlantIds.MyMatchesPagerewritten for the new query, sorting, pages and URL state.Documentation