function ProductSearchResult() {
const view = useToolContext<"search-fruits">();
if (view.status === "error") {
return <ToolErrorBanner message={view.error.message} />;
}
if (view.status === "pending") {
return <SearchSkeleton query={view.toolInput?.query} />;
}
return <Results items={view.toolOutput.items} />;
}
Read the tool invocation that rendered this View.
The hook starts pending with an optional progressive
toolInput, then latches the first structured success or tool error for the View's lifetime. If the host cancels the call first, the hook latchesstatus: "error"with a ToolCancelledError. Later lifecycle notifications cannot overwrite that terminal context.