Skip to content

feat(react): add stable lifecycle events - #53

Merged
aryasaatvik merged 4 commits into
mainfrom
split/react-lifecycle-events
Aug 30, 2026
Merged

feat(react): add stable lifecycle events#53
aryasaatvik merged 4 commits into
mainfrom
split/react-lifecycle-events

Conversation

@aryasaatvik

Copy link
Copy Markdown
Member

Summary

  • expose structured lifecycle events through DomainKit.Root
  • keep the latest host callback without restarting the managed runtime
  • publish events only after canonical state changes and isolate observer failures
<DomainKit.Root
  onEvent={(event) => analytics.track(event._tag, event)}
  transport={transport}
>
  {children}
</DomainKit.Root>
successful mutation -> canonical state update -> best-effort host event

Validation

  • React package typecheck
  • 54 React unit tests
  • repository lint, format, and diff checks

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Tegami

This repository uses Tegami to manage releases. When your changes affect published packages, add a changelog file under .tegami/ before merging.

Create a changelog → · Changelog format

Release preview

Package Bump Version
domainkit minor 0.3.10.4.0
@domainkit/react minor 0.3.10.4.0

Changelogs in this PR

Changelog Title
react-lifecycle-events.md Expose structured lifecycle events

Run bun run tegami locally to create a changelog interactively.

Managed by Tegami.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown

Greptile Summary

The PR exposes structured lifecycle events from DomainKit.Root, keeps event delivery independent of managed runtime identity, and isolates host-observer exceptions.

  • Adds public event types for connection, disconnection, provisioning, and cleanup outcomes.
  • Emits events after canonical state updates.
  • Synchronizes the latest committed listener through a layout effect without rebuilding active models.
  • Adds coverage for listener updates, observer failures, and provisioning callback ordering.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
packages/react/src/domain-kit.tsx Adds a stable emitter backed by the latest listener committed in a layout effect; the previously reported render-phase and passive-effect listener windows are resolved.
packages/react/src/lifecycle.ts Defines and exports the structured lifecycle-event union and listener contract.
packages/react/src/provisioning.tsx Emits apply outcomes before invoking the existing flow callback, resolving the previously reported event-suppression path.
packages/react/src/connection.tsx Publishes successful connection, reuse, and disconnection lifecycle events after updating state.
packages/react/src/cleanup.tsx Publishes successful and partial cleanup events after canonical cleanup state changes.
packages/react/tests/lifecycle-events.test.tsx Covers stable listener replacement, observer exception isolation, and provisioning event ordering.

Sequence Diagram

sequenceDiagram
  participant User
  participant Flow as DomainKit flow
  participant Transport
  participant State as Canonical state
  participant Host as Root onEvent
  User->>Flow: Start mutation
  Flow->>Transport: Execute request
  Transport-->>Flow: Successful result
  Flow->>State: Commit result
  Flow->>Host: Emit structured lifecycle event
  Note over Flow,Host: Observer failures are contained
Loading

Reviews (5): Last reviewed commit: "chore(release): note React lifecycle eve..." | Re-trigger Greptile

Comment thread packages/react/src/provisioning.tsx
Comment thread packages/react/src/domain-kit.tsx Outdated
Comment thread packages/react/src/domain-kit.tsx Outdated
@aryasaatvik
aryasaatvik force-pushed the split/react-lifecycle-events branch from 7afb165 to 9ae8081 Compare August 30, 2026 23:08
@aryasaatvik
aryasaatvik merged commit d48c931 into main Aug 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant