Skip to content

bug: MentorProfileCard tab indices break when optional Reviews/Resources tabs are hidden #301

Description

@yingliu-data

Bug Report

MentorProfileCard tab indices break when optional tabs are conditionally rendered, making a panel show the wrong content or become unreachable.

src/components/MentorProfileCard.tsx:166-171 — the Reviews and Resources <Tab>s are conditional, but the panels use hardcoded indices: TabPanel index={2} (Reviews, line ~275) and index={3} (Resources, line ~314).

Reproduction

A mentor has resources but no feedbackSection → MUI assigns the Resources tab value 2 → clicking it shows the (empty) Reviews panel at index 2, and the Resources panel at index 3 is unreachable.

Severity

Medium

Potential Risk

  • Mentor resources/reviews are shown under the wrong tab or hidden entirely.

Suggested Fix

  • Compute tab values dynamically (assign indices based on which tabs are actually rendered) instead of hardcoding 2/3, so tab and panel indices always agree.
  • Add a test for a mentor with resources but no reviews (assert the Resources panel is reachable and correct).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions