Repository navigation
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: an ask that can't be answered now resolves Notes
[DESIGN-REVIEWED] 3b822c4 Description read[DESCRIPTION-READ] 87de3ec781daf6c67a9b22e20b0777e91b4db471c3612a6afd0c8611b674fb1e That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The confirm dialog looks the same as before. It now stays open through Issue Radar's crew-page loading and error states instead of vanishing, and its title still names the crew it will retire. Notes
[UX-REVIEWED] 3b822c4 Description read[DESCRIPTION-READ] 4b6d8fcd76751b74724c6dc16c893841dfbf679ab92a9ad7d664e2d4abb1c572 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The hook-level change fixes the cause: any ask whose dialog cannot answer now settles false, whichever owner drops it. The fix is pinned by tests that drive the Issue Radar crew page through each branch. Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: an awaited in-app confirmation always releases its caller, and only the dialog on screen can approve it. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 3b822c4 Description read[DESCRIPTION-READ] 3b51b1624f8e7e382413c34bb84bfca5a0960175f5793e893aa07fb60cf245b1 That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
012a953 to
129c28d
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Request changes at 129c28d. Only issue links are needed. The code looks sound.
The new lifecycle holds up in the cases I traced. Only the committed controls of the current question can answer true (settle). A missing dialog answers false. A same-commit remount keeps the ask, because the cancel check waits for a microtask and OverlayPortal mounts synchronously (code).
Two follow-ups are stated but not tracked. #15976 does not cover either one:
- The description says the other
useConfirmowners were not audited branch by branch, and Design Review found one:ArtifactDetailPage's loading, error and not-found returns dropconfirmDialog(L326, L330, L359). With this PR such an ask answers false, which is safe, but the dialog still vanishes. - The "Accepted deferral" for asks held behind a transition or a suspended owner ("Revisit when one does").
Please fix them here or open one issue per item and link them in the description.
AI findings judged non-blocking
- Design (note): a root-level confirm host would make the missing-dialog case impossible. Does not block: this is advice for later PRs, and nothing in this diff is harmed.
- UX (note):
CrewPageViewremounts the dialog on a branch switch and replays its entry animation. Does not block: the effect is cosmetic, and the ask survives the remount (code). - First Principles (note):
deferred<T>()intest/helpers.tsxduplicates an existing export. Does not block: the duplicate is test-only (code).
— crew-pr-reviewer (r146)
useConfirm() hands the caller a promise and leaves the dialog to the owner's JSX. When that dialog was never rendered, stopped being rendered (Issue Radar's loading and error branches dropped it), or its owner went away, the awaiting caller was never released, or a retained affirmative click handler could still approve the pending question with no dialog on screen. Most native dialogs this series replaces will await useConfirm(), so the hook has to settle first. An ask now answers false when its owner unmounts (including an owner deleted while hidden by Suspense), a newer ask replaces it, or its controls are not rendered or are removed. Only the controls mounted for the current question can answer true, and a newer question survives the previous dialog's exit callback. Modal gains onExitComplete so the hook drops the answered question once its exit animation ends without clearing a newer one, and Issue Radar's crew page renders its dialog on the loading and error branches. An ask made while React holds the owner's update (a pending transition or a suspended ancestor) stays open until React commits it, then appears normally. The useConfirm doc comment states this contract. Part of kirodotdev#15976
129c28d to
3b822c4
Compare
bolichen97
left a comment
There was a problem hiding this comment.
LGTM. I read the whole diff, tests included.
useConfirmnow answersfalsewhen the owner unmounts, a newer ask replaces the old one, or the dialog is never rendered or stops being rendered. Callers no longer hang.- Only the mounted
ConfirmControlsfor the current question can answertrue, so a stale Confirm handler cannot approve an ask whose dialog is gone. onExitCompletekeeps the answered question's title and buttons through the exit animation, and it does not clear a newer question.CrewPageViewnow rendersconfirmDialogin the loading and error branches too, and the newit.eachtest covers all three branches.- The new tests cover StrictMode, Suspense, transitions and same-commit remounts. The change is frontend only, with no regex and no new refusal. All 94 checks are green.
The open change request from another reviewer asks only for issue links for the follow-ups, not for code changes.
|
@iamwhatever, would you re-review this when you have a moment? Your request was for issue links on the two follow-ups, and both are now in the description:
The PR has an approval on the current head since your review, and the code has not changed in response to it. D03, D04 and the leave-guard PRs are stacked on this one, so they are waiting on it. |
Problem / Motivation
Goal: An in-app confirmation always releases the code awaiting it, and only the dialog currently on screen can approve it.
useConfirm()returns a promise and relies on the owner to renderconfirmDialog. Today the promise can stay pending: Issue Radar's crew page dropped its dialog when it fell back to the loading or error branch, so a retirement ask raised on the crew page vanished and stayed pending until the page content returned, or for good if the error persisted. A Confirm click handler retained from a removed dialog could also approve the pending question while no dialog for it was on screen.Why it matters
Most native
confirm()calls still onmainwill be replaced by anawait useConfirm()call in the follow-up PRs of the series for #15976. A hung await leaves the action suspended, and a late approval runs a destructive action the user is no longer looking at.Not a goal
confirm,alertorpromptcall. The allowlist is unchanged.interactionDisabled.What changed (motivation → approach → change)
The hook tracked only "a question is pending", so it could not tell whether anything on screen could answer it. It now tracks the question and the controls that rendered it.
ConfirmDialog.tsx: the Cancel and Confirm buttons moved intoConfirmControls, which reports mount and unmount for its question. An ask answers false when its owner unmounts, a newer ask replaces it, or its controls are missing or removed. Only the mounted controls of the current question can answer true, so a stale callback from a destroyed or replaced dialog is ignored. Options are retained as the question object until the exit animation finishes, and a newer question is never cleared by an older dialog's exit.Modal.tsx: an optionalonExitCompletepassed toAnimatePresence.CrewPageView.tsx: rendersconfirmDialogon the loading and error branches.useConfirmdoc comment states the contract.Accepted deferral: an ask made while React holds the owner's update stays open until React commits, then appears normally and still needs a click on the current controls. Cases: (a) a replacement ask in a transition with a suspending body, (b) an ask after a suspending sibling already hid the owner, (c) a transition with a suspending sibling. No production caller was found that asks inside
startTransitionor passes a suspending body (git grep -nE "startTransition|useTransition" -- website/src ':!website/src/test'finds only comments). Revisit when one does. Tracked in #30960.Backwards compatibility
Compatible:
useConfirm()keeps its signature andconfirmOpenstill means an unanswered question. Asks that previously never settled now answer false, and approval from controls that are no longer mounted is ignored.Modalgains an optional prop.Removes nothing: the internal
lastOptsRefis replaced by retained question state. No exported name, prop or key is removed.Tests
ConfirmDialog.test.tsxandIssueRadarCrewPage.test.tsxlock in: replacement answers the old promise false; Cancel, Escape, backdrop and X answer false; owner unmount, an omitted dialog, and a removed dialog answer false; a stale or detached Confirm callback cannot approve after its dialog is removed or remounted; a retainedconfirmcalled after owner unmount answers false; a replacement that never commits answers false while a renderer retains the older question; a transition ask stays open and answerable after React commits; a newer question survives the previous exit; an ask from a descendant's first layout effect and from a passive effect works; hidden-owner deletion settles false; a retirement ask on Issue Radar's crew page stays on screen through the loading, error and missing-crew branches and still retires the crew it named. Most cases run in both normal and StrictMode trees. Deferred promises and controlled microtasks are used, with no sleeps.Proof: not provable -- frontend test (prove.py runs Python only). Disabling the insertion-phase validity, layout-disconnect cancellation, passive lifetime invalidation and committed-pending check in turn each made its matching tests fail.
Manual verification
N/A: lifecycle logic covered by the tests above. The dialog markup and styling are unchanged.
Screenshots / video
Why no screenshot: the confirm dialog's markup and styles are unchanged. The Cancel and Confirm buttons moved into a sibling component with the same props and classes.
Related Issues
Part of #15976
Sibling sweep
Swept:
git grep -n "useConfirm()\|useDialogConfirm()" origin/main -- website/srcSibling: website/src/components/crew/useDialogConfirm.tsx -- tracked in #15976 -- keeps its own state machine with no rendered-surface check, handled in the Radix confirmation PR of this series.
Sibling: website/src/apps/issue-radar/views/CrewPageView.tsx -- changed here -- the owner found whose early returns dropped the dialog. The other owners render it under their own alias and were not audited branch by branch.
ArtifactDetailPagedrops it on its loading, error and not-found returns; #30515 fixes that.Pattern harvest
Rule candidate: review-prompt
Pattern: an awaited UI prompt whose owner can return JSX without rendering the prompt's dialog.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.