Interface: PlayErrorBoundaryProps
API / @xmachines/play-react / PlayErrorBoundaryProps
Defined in: packages/play-react/src/PlayErrorBoundary.tsx:14
The props of PlayErrorBoundary
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
children | ReactNode | The child components to render | packages/play-react/src/PlayErrorBoundary.tsx:18 |
fallback? | ReactNode | The fallback UI to render when a child component throws. The default is null. | packages/play-react/src/PlayErrorBoundary.tsx:16 |
onError? | (error, info) => void | The optional error handler. It sends each error to an observability tool, such as Sentry | packages/play-react/src/PlayErrorBoundary.tsx:20 |
resetKey? | unknown | The reset key. The boundary clears its error state when this value changes, and it renders the children again. ActorProvider gives it the current view. A view transition therefore retries the render. Without the key the boundary holds the fallback for the complete life of the provider: the user sends a recovery event, the actor moves to a healthy view, and the screen keeps the fallback. The boundary compares the value by IDENTITY (Object.is) by default. Give a stable reference. An inline object literal — resetKey={{ view }} — is a new value on every render, so the boundary clears its caught error before each one, renders the children that threw, catches again, and calls onError again. Hold the value where it survives a render, and build a new one only when an input moves. PlayErrorBoundaryProps.resetKeyEquals takes the identity rule away, and a caller that gives one needs no stable reference at all. | packages/play-react/src/PlayErrorBoundary.tsx:39 |
resetKeyEquals? | (previous, next) => boolean | The comparison of two reset keys. The default is Object.is. The boundary clears its error where this function answers false. A caller that builds a key of several inputs therefore compares those INPUTS, and it owes the boundary no stable reference for the key that carries them. That is what ActorProvider gives. A key of the three view inputs and the retry nonce holds no identity of its own across renders — React makes no promise to keep a useMemo, and a ref that the render writes survives a render that React throws away, which the documentation of React forbids for that reason. With a comparison of the fields, a key that carries the same inputs is the same key, whichever render built it. The state of this class is the key of the last COMMIT: React commits the state of a class with the commit, so a render that React discards writes none. The comparison therefore reads the committed key on one side every time. | packages/play-react/src/PlayErrorBoundary.tsx:63 |