Joint session with Vercel: How to build intelligent storefronts (May 15th)

Patching Insert an Array Field in a Query

1 replyLast updated: Aug 9, 2022

when trying to patch insert an array, if the array is empty, it won't do anything and that array field is not even present in the query but is present in the dashboard UI.
Hey user S! You'll need to add a
setIfMissing
method as shown in this example.

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions