fix(team-view): hide the "Direct reports only" toggle for teams with no subteams - #197
Conversation
…eams When every report is direct, scoping to direct reports can never change the roster, so the "Direct reports only" switch was a no-op that only flipped the header label. Gate it (in both team views) on the roster actually containing an indirect report, via a shared hasIndirectReports helper. The old view's IC/team view toggle keeps its roster-only gate. Fixes constructorfabric/insight#1756 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Roman Mitasov <roman.mitasov@constructor.tech>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughBoth team dashboard variants now hide direct-report controls when a roster contains no indirect reports. A shared helper detects indirect entries, and tests cover nested teams, flat teams, empty rosters, and null rosters. ChangesDirect-report scoping
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Covers the changed gate lines for the diff-coverage check and mirrors the v2 screen tests: scoping on/off, and the toggle hidden for a team with no subteams. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Roman Mitasov <roman.mitasov@constructor.tech>
Fixes constructorfabric/insight#1756. Follow-up to #192.
When a manager's reports are all direct (no subteams), scoping to direct reports can never change the roster — the toggle was a no-op that only flipped the header subtitle between "Direct reports of X" and "X's department" over the same members (visible as an
(N/N)counter).Changes
identity-tree.ts: new sharedhasIndirectReports(roster)helper — true only when the roster contains a depth>1 report.team-view-v2.tsx: the toggle and the scope subtitle render only when the team has indirect reports; otherwise the subtitle is just the member count and the full roster reaches the queries unscoped.team-view.tsx(old view): the same gate oncanFilterDirectReports; the IC/teamIcViewTogglekeeps its previous roster-only gate (hasRoster) so flat-team managers don't lose it.Tests
identity-tree.test.ts:hasIndirectReportsfor mixed, flat, empty, and null rosters.team-view-v2.test.tsx: a flat-team render asserts no switch, no scope label, and the unscoped roster reachinguseTeamMembers.🤖 Generated with Claude Code
Summary by CodeRabbit
Improvements
Tests