Skip to content

fix(team-view-v2): restore "Direct reports only" toggle from the old UI - #192

Merged
mitasovr merged 1 commit into
mainfrom
fix/team-v2-direct-reports-toggle
Jul 13, 2026
Merged

fix(team-view-v2): restore "Direct reports only" toggle from the old UI#192
mitasovr merged 1 commit into
mainfrom
fix/team-v2-direct-reports-toggle

Conversation

@mitasovr

Copy link
Copy Markdown
Contributor

Fixes constructorfabric/insight#1724

Problem

The v2 team dashboard always rendered the full subtree (flattenSubordinates(pivot)), dropping two things the old team view had:

  • the "Direct reports only" toggle (default on) that narrows the roster to depth-1 reports;
  • the "Direct reports of X" / "X's department" subtitle distinction.

A manager on the new dashboard could no longer scope the view to their direct reports.

Approach

Unlike the old screen's client-side row filter, the roster is scoped before it reaches any query. In v2 the roster drives the server-side person_id in (...) filters, so members, heatmap bullets, legacy sections, and metric collections all narrow together — the old screen's per-section AI-adoption rescoping hack isn't needed here.

  • identity-tree.ts: new pure helper scopeRosterToDirectReports(roster, directOnly); null passes through so screens keep their roster-not-loaded gate.
  • dashboard-header.tsx: optional actions slot rendered before the period selector.
  • team-view-v2.tsx: directReportsOnly state (default on, matching the old UI), scoped roster memo, scope subtitle, and the toggle with a scoped/total count next to it.

Tests

  • identity-tree.test.ts: flattenSubordinates marks only depth-1 reports as direct; the scoping helper filters / passes through as specified.
  • team-view-v2.test.tsx: screen-level test (child widgets stubbed) asserting the default direct-only scope reaches useTeamMembers upstream of the fetch, the toggle widens to the full department, and both subtitle variants render.

pnpm typecheck, pnpm lint, and the full unit suite (267 tests) pass.

🤖 Generated with Claude Code

@mitasovr
mitasovr requested a review from a team as a code owner July 10, 2026 14:05
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mitasovr, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a0bd2476-38e5-474c-bec0-36dba4136436

📥 Commits

Reviewing files that changed from the base of the PR and between 675c401 and 7d85ca9.

📒 Files selected for processing (5)
  • src/components/widgets/v2/dashboard-header.tsx
  • src/lib/insight/identity-tree.test.ts
  • src/lib/insight/identity-tree.ts
  • src/screens/team-view-v2.test.tsx
  • src/screens/team-view-v2.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/team-v2-direct-reports-toggle

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The v2 team dashboard always rendered the full subtree
(flattenSubordinates), dropping the direct/department scoping the old
team view had. Restore the toggle (default on, matching the old UI)
and the "Direct reports of X" / "X's department" subtitle distinction.

Unlike the old screen's client-side row filter, scope the roster before
it reaches any query: in v2 the roster drives the server-side
person_id filters, so members, heatmap bullets, legacy sections, and
metric collections all narrow together — no per-section rescoping
needed.

- identity-tree: add scopeRosterToDirectReports (null passes through
  so screens keep their roster-not-loaded gate)
- dashboard-header: optional `actions` slot before the period selector
- team-view-v2: toggle state + scoped roster + scope subtitle

Fixes constructorfabric/insight#1724

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Roman Mitasov <roman.mitasov@constructor.tech>
@mitasovr
mitasovr force-pushed the fix/team-v2-direct-reports-toggle branch from 20a33ac to 7d85ca9 Compare July 10, 2026 14:07
@mitasovr
mitasovr requested a review from aleksdotbar July 10, 2026 14:07
@mitasovr
mitasovr merged commit 9f2996b into main Jul 13, 2026
6 checks passed
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.

frontend: new team dashboard is missing the 'Direct reports only' toggle from the old UI

3 participants