Skip to content

fix: scope mentors page default view to the open cycle's type (#304)#305

Open
yingliu-data wants to merge 1 commit into
mainfrom
fix/304-mentors-scope-to-open-cycle
Open

fix: scope mentors page default view to the open cycle's type (#304)#305
yingliu-data wants to merge 1 commit into
mainfrom
fix/304-mentors-scope-to-open-cycle

Conversation

@yingliu-data

Copy link
Copy Markdown

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: selectedMentorshipType defaulted to '' and the fetch only sent mentorshipTypes when 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:

"openCycle": { "mentorshipType": "Ad-Hoc", "active": true }

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 mentorshipTypes param — hence a frontend fix rather than a backend default.

Testing

Verified locally end-to-end against the running backend:

  • Ad-Hoc cycle (July): default view auto-applies ?mentorshipTypes=Ad-Hoc and lists only mentors with July ad-hoc availability; a long-term-only mentor is correctly hidden.
  • Long-Term cycle: default view auto-applies ?mentorshipTypes=Long-Term and lists only long-term mentors; an ad-hoc-only mentor is hidden.
  • "All" filter still shows every active mentor.
  • Selecting a specific type still works.

eslint (0 errors), prettier --check, and tsc --noEmit all pass on the changed file.

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
@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

@yingliu-data

Copy link
Copy Markdown
Author

it's a flaky/environmental E2E failure, not caused by the #304 change,
request manual merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Public mentors page shows mentors outside the open cycle (default view not scoped to cycle type/month)

1 participant