Repository navigation
Conversation
Member
|
Thanks for the PR. Feel free to also check (and fix) the equipment and categories ones (but those will rarely go over the default page limit) |
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Changes
getMuscles()read onlyresultsof the first response from/api/v2/muscle/. With the server's default page size, once an instance has more than 20 muscles (e.g. after an admin adds custom ones), the rest never reach the muscle selectors in exercise creation and the other places that useuseMusclesQuery. This is what's described in the issue: some muscles disappear, and they come back once the total is down to 20.limit=API_MAX_PAGE_SIZEand followsnextthrough the existingfetchPaginated()helper, the same waygetExercises()and the session/measurement APIs already do.getEquipment()(and possibly categories) use the same single-page pattern. I left them out to keep this PR to the reported bug, but can do the same change in a follow-up if you want.Related Issue(s)
Closes wger-project/wger#1737
Please check that the PR fulfills these requirements
New test in
muscles.test.ts: with a two-page response,getMuscles()returns muscles from both pages, the first request carries the max page size, and the second request uses thenextURL. It fails without the change.What I ran locally (Node 24):
LANG=de_de npx vitest run(180 files / 1175 tests pass),npx eslint src/components/Exercises/api, andnpx tsc --noEmit. I didn't check this against a running server with more than 20 muscles.AI assistance was used to write this change. I reviewed the diff and ran the checks above.