Skip to content

fix(inbox): refetch + virtualize + server-search the people pickers#2616

Draft
Twixes wants to merge 1 commit into
mainfrom
posthog-code/inbox-people-picker
Draft

fix(inbox): refetch + virtualize + server-search the people pickers#2616
Twixes wants to merge 1 commit into
mainfrom
posthog-code/inbox-people-picker

Conversation

@Twixes

@Twixes Twixes commented Jun 11, 2026

Copy link
Copy Markdown
Member

Problem

The inbox assignee / "Entire project" scope selector broke: it didn't re-fetch, so the people list went stale (reported by Olly/Rafa in Slack). While in there, the PostHog/code people listings in both Reviewers and Entire project also needed: a virtualized list, server-side search, and a helpful empty state.

Changes

  • New shared PeoplePickerList — a searchable, virtualized people list (only visible rows mount, so it stays responsive for large orgs) with the empty-state hint.
  • New shared useReviewerPickerOptions hook driving server-side search through the available_reviewers ?query= param (debounced), and pinning "me" only on the unfiltered base list.
  • Reviewers picker (SuggestedReviewersSection) and inbox scope picker (InboxScopeSelect) both rewired onto the shared list.
  • Re-fetch bug fix: the scope dropdown's data now lives inside a Popover whose content only mounts while open, so the query re-mounts and re-fetches on every open instead of staying mounted and stale.
  • Empty state: when no people match, the dropdown shows "Someone not showing up here? Ask them to connect their GitHub profile with PostHog", linking to the personal settings page (/settings/user).

Note on "fetch missing entries as you scroll": the available_reviewers endpoint returns the full set of people in one response (a UUID→person dict, no count/pagination), so there are no missing pages to fetch — virtualization covers the rendering cost. True incremental fetch-on-scroll would need a paginated backend endpoint (in the posthog Django repo) first; the shared list is structured so it can be extended to infinite scroll if/when that lands.

How did you test this?

  • pnpm build (all packages) — green.
  • pnpm --filter @posthog/ui typecheck — green.
  • biome check on the changed/added files — clean.
  • No existing tests reference these components; mobile uses its own separate inbox flow and is unaffected.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code from a Slack thread

The inbox scope ("Entire project") selector kept its people query mounted
permanently, so it never re-fetched on open and went stale until the 60s
background refetch — the reported "assignee listing doesn't re-fetch" bug.

Rework both people pickers (Reviewers + inbox scope) onto a shared,
virtualized `PeoplePickerList`:
- The list now lives in a Popover whose content only mounts while open, so
  the query re-fetches on every open.
- Search is server-side via the `available_reviewers` `?query=` param
  (shared `useReviewerPickerOptions` hook), debounced.
- Rows are virtualized so large orgs stay responsive.
- An empty result surfaces a hint to connect a GitHub profile, linking to
  the PostHog personal settings page.

Generated-By: PostHog Code
Task-Id: 0bc8b5f0-0480-4c5e-8791-1a4a9736a6e7
@github-actions

Copy link
Copy Markdown

React Doctor could not complete this scan.

No React dependency found in /tmp/react-doctor-baseline-ZRVhfQ/package.json. Add "react" to dependencies (or peerDependencies) and re-run.

Reviewed by React Doctor for commit 9028a64.

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. packages/ui/src/features/inbox/hooks/useReviewerPickerOptions.ts, line 837-841 (link)

    P2 Unused hasResults field in returned object

    hasResults is exported in the ReviewerPickerOptions interface and computed in the hook body (!!data?.results?.length), but it is not consumed by either of the hook's two callers — ScopePickerContent and SuggestedReviewersBody — after the AddReviewerPopover refactor removed the last reference to it. The field is superfluous and should be removed along with the hasResults line in ReviewerPickerOptions.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: packages/ui/src/features/inbox/hooks/useReviewerPickerOptions.ts
    Line: 837-841
    
    Comment:
    **Unused `hasResults` field in returned object**
    
    `hasResults` is exported in the `ReviewerPickerOptions` interface and computed in the hook body (`!!data?.results?.length`), but it is not consumed by either of the hook's two callers — `ScopePickerContent` and `SuggestedReviewersBody` — after the `AddReviewerPopover` refactor removed the last reference to it. The field is superfluous and should be removed along with the `hasResults` line in `ReviewerPickerOptions`.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/ui/src/features/inbox/hooks/useReviewerPickerOptions.ts:837-841
**Unused `hasResults` field in returned object**

`hasResults` is exported in the `ReviewerPickerOptions` interface and computed in the hook body (`!!data?.results?.length`), but it is not consumed by either of the hook's two callers — `ScopePickerContent` and `SuggestedReviewersBody` — after the `AddReviewerPopover` refactor removed the last reference to it. The field is superfluous and should be removed along with the `hasResults` line in `ReviewerPickerOptions`.

Reviews (1): Last reviewed commit: "fix(inbox): refetch + virtualize + serve..." | Re-trigger Greptile

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.

1 participant