Callback that is called when the stream is stopped by the user. Provides a mutate function to update the stream state immediately without requiring a server roundtrip.
Stopping a running stream then reads the thread's state again and applies each update once more on top of it, so a function update runs twice: first on the stopped stream's values, then on the state the server kept.
onStop: (options: __type) => voidonStop: ({ mutate }) => {
mutate((prev) => ({
...prev,
ui: prev.ui?.map(component =>
component.props.isLoading
? { ...component, props: { ...component.props, stopped: true, isLoading: false }}
: component
)
}));
}