Conversation
* perf(people): move heavy data fetches off the shared server page
The People page server component was re-running every expensive query
(Fleet API, S3 signed URL, device-agent + Fleet + org-chart queries) on
every tab click because `router.replace()` triggers a full re-render.
Strip page.tsx to just auth + the member query needed to decide whether
the Tasks tab shows, and push tab-specific data into client components
that fetch via SWR hooks. Also:
- Add Next.js API routes for agent devices and fleet hosts
(`/api/people/agent-devices`, `/api/people/fleet-hosts`) so client
hooks can call them.
- `DevicesTabContent`, `OrgChartTabContent`, and `TeamMembersClient`
now use `useAgentDevices` / `useFleetHosts` / `useOrgChart`. SWR's
shared cache means devices are fetched once across People + Devices
tabs.
- Consolidate the four per-scope `PeopleFindings` sections into a
single `Findings` tab with a unified list. `CreateFindingSheet`
accepts `scopeOptions` so the picker lives inside the form.
- `FindingsOverview` now links people-scoped findings to
`?tab=findings` since they no longer live on the per-area tabs.
Also align the auditor view with the rest of the app:
- Drop the redundant `(overview)/layout.tsx` wrapper (PageLayout
already handles the container).
- Use `PageLayout header={<PageHeader>}` pattern from `/frameworks`.
- Extract `ExportEvidenceButton` and fix the nested `<button>`
hydration error by styling PopoverTrigger directly (same pattern
as `TasksPageClient`).
- Replace the custom `<Section>` with `@trycompai/design-system`
`Section` + `Stack`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(people): address review feedback for SWR scoping, perf, and data correctness
Scope SWR keys by orgId to prevent stale cross-org data, pre-index
fleet policy results for O(1) lookups, batch Fleet API calls to limit
concurrency, validate both x/y in org chart positions, and filter
deactivated members from agent device queries.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Lewis Carhart <lewis@trycomp.ai>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
4 issues found across 25 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/app/src/app/(app)/[orgId]/people/devices/components/DevicesTabContent.tsx">
<violation number="1" location="apps/app/src/app/(app)/[orgId]/people/devices/components/DevicesTabContent.tsx:15">
P2: Neither loading nor error states from the hooks are handled. `DeviceComplianceChart` renders unconditionally with empty arrays while data is still being fetched, which can flash a misleading zero-state chart. Consider destructuring `isLoading`/`error` and showing a loading indicator or error message.</violation>
</file>
<file name="apps/app/src/app/api/people/fleet-hosts/route.ts">
<violation number="1" location="apps/app/src/app/api/people/fleet-hosts/route.ts:96">
P1: Use optional chaining on `host.mdm` to avoid a runtime `TypeError` if the Fleet API returns a host without MDM data.</violation>
</file>
<file name="apps/app/src/app/(app)/[orgId]/auditor/(overview)/components/ExportEvidenceButton.tsx">
<violation number="1" location="apps/app/src/app/(app)/[orgId]/auditor/(overview)/components/ExportEvidenceButton.tsx:43">
P2: Use `PopoverTrigger asChild` with a `Button` instead of hand-rolling button styles. The design system already supports this pattern (e.g., `MultiRoleCombobox`), and these inline classes will drift from the actual `Button` component over time.</violation>
</file>
<file name="apps/app/src/app/(app)/[orgId]/people/all/components/TeamMembersClient.tsx">
<violation number="1" location="apps/app/src/app/(app)/[orgId]/people/all/components/TeamMembersClient.tsx:71">
P2: The `isLoading` state from both `useAgentDevices()` and `useFleetHosts()` is ignored. While data is loading, all members will briefly show a 'not-installed' device status because the `useMemo` runs on empty arrays. Consider either gating the table/device-status column on the loading state, or passing a loading indicator so `MemberRow` can show a skeleton/spinner for the device column.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
) - Guard host.mdm access in fleet-hosts route to avoid runtime TypeError - Show loading/error states in DevicesTabContent so the compliance chart no longer flashes an empty-state while fetching - Render a skeleton in the MemberRow device column while device data loads instead of defaulting to 'Not Installed' - Replace hand-rolled button styles on PopoverTrigger with base-ui render pattern using Button Co-authored-by: Lewis Carhart <lewis@Lewiss-MacBook-Air.local> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
🎉 This PR is included in version 3.23.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.
Summary by cubic
Moves heavy People data fetching to client hooks and adds a unified Findings tab; aligns Auditor View with the app layout and adds an evidence export. This improves navigation performance and simplifies people-scoped workflows.
New Features
CreateFindingSheet.ExportEvidenceButtonto Auditor View; header now usesPageLayoutandPageHeader.Refactors
useAgentDevices,useFleetHosts,useOrgChart) backed by new API routes (/api/people/agent-devices,/api/people/fleet-hosts) with org-scoped keys.?tab=findings); removed legacy per-scope findings components/tests and redundant auditor(overview)/layout; replaced custom sections withSectionandStackfrom@trycompai/design-system.MemberRow; guardedhost.mdmaccess in/api/people/fleet-hoststo prevent runtime errors.Written for commit ca71fa8. Summary will update on new commits.