Host lifecycle
Compose connection, plan review, apply, receipt-bound cleanup, and disconnect actions into a host-owned domain row and product lifecycle.
This integration level keeps DomainKit’s controllers and dialogs while your application owns the outer lifecycle row and decides when each action is available.
import { Cleanup, Connection, Provisioning } from "@domainkit/react";
export function DomainActions({ domain, records, receiptId }) {
const controller = Connection.useController(domain);
if (controller.state._tag !== "Connected") {
return <Connection.Status state={controller.state} />;
}
return (
<Connection.Root status="Connected">
<Cleanup.Flow connection={controller.state} receiptId={receiptId} />
<Connection.DisconnectDialog
connection={controller.state}
controller={controller}
/>
<Provisioning.Flow
connection={controller.state}
records={records}
showRecords={false}
/>
</Connection.Root>
);
}Installation
npm install @domainkit/react domainkit effect @effect/atom-react react react-dompnpm add @domainkit/react domainkit effect @effect/atom-react react react-domyarn add @domainkit/react domainkit effect @effect/atom-react react react-dombun add @domainkit/react domainkit effect @effect/atom-react react react-domLifecycle ownership
Provisioning and cleanup are separate reviewed operations:
Provisioning.Flowrequests an exactcreate/noop/conflictplan.- The user authorizes that plan’s digest before the host applies it.
- The host persists the returned receipt, including partial results.
Cleanup.Flowplans deletion from that receipt and requests separate authorization.
Do not treat disconnecting a provider as cleanup. Your product decides whether cleanup is required, whether a receipt remains valid, and whether a user may remove records.
Product readiness
A completed provider write is not proof that public DNS has propagated. Use Verification and combine its provider/public-DNS observations with your own product readiness policy.
Accessibility
Keep destructive cleanup and disconnect actions distinguishable in text, not color alone. Preserve the confirmation dialogs, loading states, and failure outcomes supplied by the semantic parts.
API reference
Provisioning.Flow
connectionTransport.Connected
Connected domain attachment used to plan and apply records.
Transport.ConnectedonApplied?(result: Applied | Partial) => void
Called after the host returns a complete or partial apply result.
(result: Applied | Partial) => voidrecordsReadonlyArray<Transport.DnsRecord>
Product-owned DNS requirements included in the immutable plan.
ReadonlyArray<Transport.DnsRecord>showRecords?boolean
Whether the flow renders the records table alongside its review action.
booleantruetrigger?ReactElement
Optional element rendered as the review trigger.
ReactElementCleanup.Flow
connectionTransport.Connected
Connected domain attachment whose applied records may be cleaned up.
Transport.ConnectedonCleaned?(result: Cleanup.Completion) => void
Called after the host returns a complete or partial cleanup result.
(result: Cleanup.Completion) => voidreceiptIdstring
Apply receipt that bounds the records eligible for cleanup.
stringtrigger?ReactElement
Optional element rendered as the cleanup review trigger.
ReactElementConnection.DisconnectDialog
connectionTransport.Connected
Connected domain attachment to disconnect.
Transport.ConnectedcontrollerConnection.Controller
Controller that performs the detach operation.
Connection.ControlleronOpenChange?(open: boolean) => void
Called when the dialog's open state changes.
(open: boolean) => voidopen?boolean
Controlled open state. Omit it to use the dialog's internal state.
booleantrigger?ReactElement | null
Optional trigger element. Pass null to render no trigger.
ReactElement | nullRead Plans, authorization, and receipts for the lifecycle invariants behind these controls.