Skip to content

feat(ui): add handle form to Confirmation block - #9755

Merged
alexcarpenter merged 2 commits into
carp/mosaic-desctructive-to-confirmationfrom
carp/mosaic-confirmation-handle
Sep 14, 2026
Merged

alexcarpenter merged 2 commits into
carp/mosaic-desctructive-to-confirmationfrom
carp/mosaic-confirmation-handle

Conversation

@alexcarpenter

Copy link
Copy Markdown
Member

Description

Adds a second, handle-driven form to the Confirmation block, for the "one dialog, many rows" case: a members table with a Remove in every row needs one confirmation mounted once after the table, not one per row.

const removeMember = Confirmation.createHandle<Member>();

<Menu.Item color='negative' onClick={() => removeMember.open(member)}>Remove</Menu.Item>

<Confirmation
  handle={removeMember}
  title='Remove member'
  description={member => <><strong>{member.name}</strong> will be removed from the organization.</>}
  actionLabel='Remove'
  onConfirm={member => api.removeMember(member.id)}
/>
  • Confirmation.createHandle<Payload>() re-exports the Dialog handle. handle.open(payload) opens the block from anywhere; handle.close() closes it.
  • title, description, and actionLabel accept a value or a function of the payload. onConfirm receives the payload.
  • In this form the block owns open, the pending state, and the error: the promise onConfirm returns closes the dialog when it resolves, and keeps it open showing the message when it rejects. A close request while the action is pending is ignored, so a dismissal never abandons an in-flight action. That lifecycle is a small machine in confirmation.controller.ts.
  • The dialog stays mounted between opens, so exit transitions run. The payload is kept through the close for the same reason.
  • The controlled form is untouched. ConfirmationProps<Payload> is now the union of ConfirmationControlledProps and ConfirmationHandleProps<Payload>.

Swingset gets a "One block, many rows" story and docs section. The long members-table story that opens the block from a row menu follows in the next PR, on top of #9752, which makes focus return to that menu's trigger.

Stacked on #9734.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel

vercel Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
swingset Ready Ready Preview Sep 14, 2026 6:26pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
clerk-js-sandbox Skipped Skipped Sep 14, 2026 6:26pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c2094e9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Team

Run ID: 5d6d556d-b240-4572-bc89-b14fcb6a9eaf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@alexcarpenter
alexcarpenter merged commit 5fdbf3e into carp/mosaic-desctructive-to-confirmation Sep 14, 2026
10 checks passed
@alexcarpenter
alexcarpenter deleted the carp/mosaic-confirmation-handle branch September 14, 2026 20:21

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – swingset — c2094e99 Deployed Sep 14, 2026 by vercel[bot]
Preview – clerk-js-sandbox — c2094e99 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants