Patching Insert an Array Field in a Query

1 replies
Last 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.

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.

Was this answer helpful?