Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

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.

Aug 9, 2022, 12:43 PM

Hey

user S
! You'll need to add a
setIfMissing
method as shown in this example.

Aug 9, 2022, 3:52 PM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.