Sanity React App SDK v2.4.0: Support for initial values in document creation and new agent capabilities

This release introduces deeper integration with intents, more flexible data sources for queries, and refinements for document workflows. It also includes several fixes that improve error messaging and stability when working with client and projection APIs.

✨ Highlights

Intent-driven document creation with initial values

Document creation intents, like the CreateDocumentAction, now support initial values, making it easier to pre-fill fields when users create new documents via intent flows.

Better intent workflows in React

The new useDispatchIntent hook lets you dispatch intents like create, edit, and delete directly from React components. This simplifies triggering content actions in response to UI events and pairs naturally with useQuery.

useQuery and useDispatchIntent now support Canvas as a data source, enabling you to query and dispatch intents against Canvas-backed data.

New agent action support

Introduced support for Agent Actions in the SDK. This lays the foundation for richer automated workflows and interactions driven by agents from within React applications. See useAgentGenerate, useAgentPrompt, useAgentPatch, useAgentTransform, and useAgentTranslate for details.

🐛 Notable fixes and improvements

Improved error handling to give clearer feedback when getClient or useClient are called with missing or invalid options.

Better messaging for projectUserNotFound errors.

Fixed state reuse in useDocumentProjection for string projections, improving consistency and performance.