feat(mobile): forward reviewer search to the server in the inbox reviewer picker (port #2800)#2831
Open
Gilbert09 wants to merge 3 commits into
Open
feat(mobile): forward reviewer search to the server in the inbox reviewer picker (port #2800)#2831Gilbert09 wants to merge 3 commits into
Gilbert09 wants to merge 3 commits into
Conversation
…ewer picker (port #2800) The "Add reviewer" picker filtered the fetched reviewer list client-side, so typing a name that wasn't on the already-fetched page returned nothing. Forward the search query to the server (the endpoint already accepts `query`), mirroring desktop #2800. - useAvailableSuggestedReviewers takes a `query` option, includes it in the query key, and forwards it to the API. - EditReviewersSheet debounces the search box (250ms) and passes it through, dropping the client-side filter; the server is now the source of truth. - Restrict the 60s background poll to the unfiltered list so transient search terms don't each spawn their own poller. Generated-By: PostHog Code Task-Id: 5f455048-ddbe-44ca-99a5-ca0b44a3895d
|
React Doctor found 1 issue in 1 file · 1 warning. 1 warning
Reviewed by React Doctor for commit |
Contributor
Prompt To Fix All With AIFix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
apps/mobile/src/features/inbox/components/EditReviewersSheet.tsx:86-95
**Spinner flickers on background poll when the reviewer list is empty**
`isFetching` is `true` for every in-flight fetch — including the 60-second background polls. If the available-reviewer list genuinely comes back empty (e.g. a small team, an org-level filter, or a permissions edge case), the "No users found" message disappears and is replaced by a spinner for the duration of every background poll.
The original code used `isLoading`, which React Query only sets `true` when there is no cached data yet (i.e. the very first fetch). Replacing it with `isFetching` removes that guard. The fix is to check `available === undefined` alongside `isFetching`, or to destructure `isLoading` from the hook return (which in v5 is `status === 'pending'`).
### Issue 2 of 3
apps/mobile/src/features/inbox/components/EditReviewersSheet.tsx:86-96
Use `available === undefined` (no data yet) to gate the spinner so it only shows on the true first-load state, not on every subsequent background poll that returns an empty list.
```suggestion
{options.length === 0 ? (
available === undefined && isFetching ? (
<View className="flex-1 items-center justify-center">
<ActivityIndicator size="large" color={themeColors.accent[9]} />
</View>
) : (
<View className="flex-1 items-center justify-center p-6">
<Text className="text-[14px] text-gray-10">No users found</Text>
</View>
)
) : (
```
### Issue 3 of 3
apps/mobile/src/features/inbox/hooks/useInboxReports.test.ts:36-51
**Tests should be parameterised**
Both test cases exercise the same flow (input query → expected call argument) and differ only in their data. This is a good candidate for `it.each`, which keeps the logic in one place and makes adding new cases trivial.
Reviews (1): Last reviewed commit: "feat(mobile): forward reviewer search to..." | Re-trigger Greptile |
Use isLoading instead of isFetching so the "No users found" empty state isn't replaced by a spinner during background polls when the list is genuinely empty. isLoading still covers an in-flight search because each distinct query string is its own cache entry with no data yet. Also parameterize the available-reviewers query-forwarding test with it.each. Generated-By: PostHog Code Task-Id: 5f455048-ddbe-44ca-99a5-ca0b44a3895d
Generated-By: PostHog Code Task-Id: 3b645159-1cd8-4296-a723-61f59ae5f537
tatoalo
approved these changes
Jun 23, 2026
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.
Summary
Ports desktop #2800 ("fix(inbox): forward reviewer search query to the server") to the React Native / Expo mobile app.
The inbox "Add reviewer" picker previously fetched the available-reviewers list once and filtered it client-side only, so typing a name that wasn't on the already-fetched page returned no results. This forwards the search query to the server (the
available_reviewersendpoint already accepts aqueryparam), making the server the source of truth — matching #2800's intent.Changes
useAvailableSuggestedReviewersnow accepts aqueryoption, includes it in the React QueryqueryKey(so distinct searches cache separately), and forwards it togetAvailableSuggestedReviewers(query).EditReviewersSheetdebounces the search input (250ms via a smalluseDebouncedValuehook) and passes it into the hook; the client-sidefilteris removed. Loading usesisFetchingso the spinner shows while a server search is in flight.ReviewerFilterSheet(no search box) is unchanged — it calls the hook with no query and keeps fetching the full list.Scope
Mobile only — no desktop or shared-package changes.
Testing
useInboxReports.test.tsverifies the hook forwards a trimmed query and omits the param when empty.pnpm --filter @posthog/mobile test src/features/inbox→ 52 passed.