fix: scope mentors page default view to the open cycle's type (#304)#305
Open
yingliu-data wants to merge 1 commit into
Open
fix: scope mentors page default view to the open cycle's type (#304)#305yingliu-data wants to merge 1 commit into
yingliu-data wants to merge 1 commit into
Conversation
On first load, default the mentorship-type filter to the open cycle's type (from the API's openCycle field) so an ad-hoc cycle lists only ad-hoc mentors and a long-term cycle only long-term mentors. The backend then applies the full type + month scoping. Applied once via a ref so an explicit "All" selection is preserved. Closes #304
|
Author
|
it's a flaky/environmental E2E failure, not caused by the #304 change, |
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.



Summary
Fixes #304 — the public mentors page showed mentors who don't belong to the currently open cycle (e.g. a long-term-only mentor, or a mentor with the wrong month's availability, during an Ad-Hoc cycle).
The page loaded the unscoped default list:
selectedMentorshipTypedefaulted to''and the fetch only sentmentorshipTypeswhen present in the URL, so the initial request had no type filter and the backend returned all active mentors. The backend already scopes correctly by type and month when the filter is passed, and already returns the open cycle in the response:This change uses that: on first load, when the user hasn't explicitly chosen a type, it defaults the mentorship-type filter to
openCycle.mentorshipType, which triggers the backend's existing type + month scoping. Applied once via a ref so an explicit "All" selection is preserved.Only the client can make this decision, since both "default view" and "user chose All" send no
mentorshipTypesparam — hence a frontend fix rather than a backend default.Testing
Verified locally end-to-end against the running backend:
?mentorshipTypes=Ad-Hocand lists only mentors with July ad-hoc availability; a long-term-only mentor is correctly hidden.?mentorshipTypes=Long-Termand lists only long-term mentors; an ad-hoc-only mentor is hidden.eslint(0 errors),prettier --check, andtsc --noEmitall pass on the changed file.