Skip to main content

StateDefinitionBoundaryProps

interface
interface StateDefinitionBoundaryProps

Import

import { StateDefinitionBoundaryProps } from '@modular/sdk/view';

Members5

childrenoptional
ReactNode
observeRefreshAppliedoptional
(listener: () => void) => () => void

Subscribes to live-refresh applies and returns an unsubscribe. A refresh swaps component implementations in place, so its arrival is the other event that can make a failed render succeed — new code from the author, or the preamble's rollback re-apply restoring the last delivery whose tree mounted. Without this signal a failure card outlives the fix that would clear it. Optional because the host serves this component while the code that renders it is baked into each mod's artifact: every mod built before this prop existed still mounts today's boundary. Requiring it threw `observeRefreshApplied is not a function` out of `componentDidMount` for every such mod — a working view killed by a host-side addition. Any prop added here must stay optional for the same reason.

observeStateDefinitions
(listener: () => void) => () => void

Subscribes to growth of the host's State definition set and returns an unsubscribe. `observeStateDefinitions` on the shell-facing view context.

onError
(error: unknown) => void

Reports a caught render failure. Wired to `ViewContext.diagnostics.failed`, which is the only channel the runtime graph and the eval harness read. A boundary that catches without reporting turns a genuinely broken component into a silently blank view.

onSettled
(outcome: ViewRenderOutcome) => void

Reports that a render attempt settled, and how. The `rendered` outcome is wired to `ViewContext.diagnostics.ready`, which is what makes readiness a claim about the tree rather than about control flow. Reaching the end of the shell's `start()` proves only that `root.render` was called — it returns before React commits, and the live-refresh path returns without rendering at all. Readiness asserted there is why a view with an empty `#root` reads as healthy and reports nothing to look at. A `rendered` outcome also retracts a failure this boundary already reported: a recovery nobody reports is, to the runtime graph, a transition that never happened, so a view that recovered reads exactly like one that never did. The `failed` outcome carries no diagnostic of its own — `onError` already reported the throw. It exists so the shell learns the attempt is over. A settlement signal that only fires on success leaves every host affordance keyed to it stuck in its pending state for exactly the views whose authors most need to see past it.