Sanity App SDK
    Preparing search index...
    • Function

      Returns the five comment write actions, bound to the current instance.

      Each writes optimistically: the change shows immediately and is rolled back if the server rejects it, so an app can render straight from useComments without tracking pending state itself.

      Creating is the exception, and replyToComment counts as creating. A comment that fails to post stays on screen carrying _state.createError rather than disappearing, so passing the same commentId again retries it instead of losing what someone typed.

      The resource is resolved when an action is called rather than when the hook runs, so one set of callbacks works across several resources. Pass resource or resourceName per call to choose; otherwise the surrounding ResourceProvider decides.

      Returns CommentActions

      The five write actions

      function ResolveButton({commentId}: {commentId: string}) {
      const {setCommentStatus} = useCommentActions()

      return (
      <button onClick={() => setCommentStatus({commentId, status: 'resolved'})}>
      Resolve
      </button>
      )
      }