feat(mobile): edit suggested reviewers on inbox report detail (port #2481)#2482
Open
Gilbert09 wants to merge 2 commits into
Open
feat(mobile): edit suggested reviewers on inbox report detail (port #2481)#2482Gilbert09 wants to merge 2 commits into
Gilbert09 wants to merge 2 commits into
Conversation
…2481) Makes the suggested reviewers on an inbox signal report editable from the report detail screen, porting desktop PR #2481 to the mobile app. - New `updateSignalReportArtefact` API method (PUT-replaces artefact content). - New `useUpdateSuggestedReviewers` mutation hook with an optimistic full-replacement update that patches the cached artefacts and reconciles with server-canonicalized data on settle. - `SuggestedReviewers` becomes editable: removable reviewer chips plus an "Add" affordance opening a searchable picker (`EditReviewersSheet`) over the org's available reviewers. - Extracted a shared `ReviewerOptionRow` reused by the add picker and the existing `ReviewerFilterSheet`, and shared reviewer-option / write-shape helpers in `utils.ts`. - Fires `add_suggested_reviewer` / `remove_suggested_reviewer` analytics with `suggested_reviewer_login` / `suggested_reviewer_uuid`. - Unit tests for the write-shape mapping and reviewer matching helpers. Generated-By: PostHog Code Task-Id: a3560a8b-5ba2-46b2-bfe5-d0a9f93db8e2
tatoalo
approved these changes
Jun 4, 2026
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
apps/mobile/src/features/inbox/components/SuggestedReviewers.tsx:120-125
The "Add" button and the sheet's toggle callback are not guarded against a pending mutation, while the ✕ remove button is correctly `disabled={isPending}`. If a user opens the sheet and taps while an earlier mutation is still in-flight, `onMutate` for the second call captures the *optimistic* state from the first as its rollback snapshot. If the first mutation then fails and rolls back, it reverts to the state before both mutations, temporarily erasing the second mutation's optimistic update. `onSettled`'s refetch eventually heals the UI, but there's a visible flicker and a brief window of incorrect state.
```suggestion
<Pressable
onPress={() => setEditOpen(true)}
disabled={isPending}
accessibilityLabel="Add suggested reviewer"
hitSlop={6}
className="flex-row items-center gap-1 rounded-full border border-gray-6 px-2.5 py-1 active:opacity-70 disabled:opacity-50"
>
```
### Issue 2 of 2
apps/mobile/src/features/inbox/utils.test.ts:173-220
**Prefer parameterised tests**
The three cases under `toSuggestedReviewerWriteContent` and the three under `reviewerMatchesAvailable` are each a fixed input → expected output table and would be more concise and easier to extend as `it.each` blocks. The project convention is to always prefer parameterised tests.
Reviews (1): Last reviewed commit: "feat(mobile): edit suggested reviewers o..." | Re-trigger Greptile |
Address review feedback on the suggested reviewers UI: - Disable the "Add" button and short-circuit toggleReviewer while a mutation is in-flight so overlapping optimistic updates can't flicker or roll back to a stale snapshot. - Convert toSuggestedReviewerWriteContent and reviewerMatchesAvailable tests to it.each parameterised cases per project convention. Generated-By: PostHog Code Task-Id: 4b8dd76e-7ba9-453b-8cb8-c9441a47b3dc
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.
Ports desktop PR #2481 (
feat(inbox): edit suggested reviewers from the report detail pane) to the mobile app. The suggested-reviewers list on an inbox signal report is now editable from the report detail screen — previously it was display-only.What changed
API (
features/inbox/api.ts)updateSignalReportArtefact(reportId, artefactId, content)—PUT-replaces thesuggested_reviewersartefact content with aSuggestedReviewerWriteEntry[]. The server canonicalizes each entry to a lowercasegithub_login, withuser_uuidwinning when both are supplied.Hook (
features/inbox/hooks/useInboxReports.ts)useUpdateSuggestedReviewers(reportId)— optimistic full-replacement mutation.onMutatepatches the cached artefacts list immediately,onErrorrolls back, andonSettledinvalidates so the optimistic guess is reconciled with the server-resolved reviewer data (user records, commits, canonical login).UI
SuggestedReviewers.tsxis now editable: existing reviewers render as chips with a remove (✕) control (tap the chip to open the GitHub profile), plus an Add button that opens a searchable picker.EditReviewersSheet.tsx— a bottom sheet (consistent withReviewerFilterSheet/DismissReportSheet) listing the org's available reviewers with a search box; assigned reviewers show a check and tapping toggles add/remove.ReviewerOptionRowreused by both the add picker and the existingReviewerFilterSheet, plus shared reviewer-option and write-shape helpers inutils.ts.Analytics (
lib/analytics.ts)add_suggested_reviewer/remove_suggested_revieweraction types andsuggested_reviewer_login/suggested_reviewer_uuidproperties, fired via the existing inbox engagement tracker.Reuse
Reuses existing mobile inbox infrastructure: the available-reviewers query (
useAvailableSuggestedReviewers), inbox query keys, the sheet/modal patterns, and the engagement-tracker analytics layer.Testing
toSuggestedReviewerWriteContent,reviewerMatchesAvailable, andbuildReviewerOptions(write-shape mapping + reviewer matching).vitest run src/features/inbox— 17 passing.tscclean on the touched files.