Skip to content

Interface: PlayUIProviderProps

API / @xmachines/play-react / PlayUIProviderProps

Defined in: packages/play-react/src/PlayUIProvider.tsx:35

The props of PlayUIProvider — every ActorProvider prop, and also the props of JSONUIProvider.

Extends

Properties

PropertyTypeDescriptionInherited fromDefined in
actorViewActorThe actor instance with the currentView atom. It requires the Viewable capability.ActorProviderProps.actorpackages/play-view/src/view-types.ts:219
childrenReactNodeThe child components to render inside the provider treeActorProviderProps.childrenpackages/play-react/src/ActorProvider.tsx:95
fallback?ReactNodeThe component to show when currentView is null, or after a failure of the view. This prop is optionalActorProviderProps.fallbackpackages/play-react/src/ActorProvider.tsx:54
functions?Record<string, ComputedFunction>Named functions for $computed expressions in propsJSONUIProviderProps.functions-
navigate?(path) => voidNavigation functionJSONUIProviderProps.navigate-
onError?(error, reset, info) => voidThe optional error handler. The provider calls it when a descendant throws during a render. While the error is active, the provider renders the fallback instead of its children. The provider clears the error on the next view emission (when currentView changes), so a view transition retries the render. The per-element boundary of json-render catches a throw of a catalog component below the root, and it reports it through onRenderError alone. A failure of the ROOT — its component, a prop, or its visible condition — leaves no view, and json-render gives it to no boundary of the host. The provider contains it as a failure of the view all the same: it shows the fallback, and it calls this handler one time. onRenderError also receives it, with info.kind "root". This boundary is the outer net for everything else. The SECOND parameter is the reset, for a retry that the host starts — a “Retry” button of its own. It sits in the same place as in the four other renderers, and the React.ErrorInfo of the boundary comes third. The reset clears the contained error and renders again. It renders the view that the actor holds at the MOMENT OF THE CALL, so a host that keeps the callback cannot rewind the screen to the view that failed. A reset that the host calls from inside this handler does nothing, because no input changed between the two attempts, and a reset after the provider is unmounted does nothing. The five renderers hold the same three rules. A handler that THROWS reaches no caller. The provider contains that throw, and it writes the throw to console.error. This handler runs inside componentDidCatch, so a throw that left it would reach the boundary ABOVE this provider, and React can then unmount the complete root — which is the failure that this boundary contained. Report a failure from this handler. To ESCALATE one, raise it from a task of your own — rethrowLater(error) of @xmachines/core/utils — which reaches the global handler of the page and leaves the containment whole. The host installs @xmachines/core itself. The five renderers hold this one rule.ActorProviderProps.onErrorpackages/play-react/src/ActorProvider.tsx:93
onRenderError?OnRenderErrorThe renderer calls it with (error, name, info) for each failure that it reports: a catalog component that throws, a prop or a visible condition that fails, an action chain or a watch chain that fails, and a failure of the root. info.kind names the kind of the failure. A handler with the two parameters (error, name) stays valid. This handler replaces every onRenderError of defineRegistry.ActorProviderProps.onRenderErrorpackages/play-view/src/view-types.ts:236
registryResultDefineRegistryResultThe complete result of defineRegistry(). It holds the component registry and the factory of the action handlers.ActorProviderProps.registryResultpackages/play-view/src/view-types.ts:221
store?StateStoreThe optional external StateStore, which is the controlled mode. With this option, the provider ignores spec.state, and this store is the single source of truth. Without it, the provider makes a new @xstate/store atom for each view transition, with the values of spec.state.ActorProviderProps.storepackages/play-view/src/view-types.ts:228
validationFunctions?Record<string, (value, args?) => boolean>Custom validation functionsJSONUIProviderProps.validationFunctions-