You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm using sanity client to update one field on an object. The only way to update the object is via client.patch('id').set(fieldName: value}), but when value is an object, it overwrites the entire object on the document. Only the field specified would be nice.
Describe the solution you'd like
If an object field is set in the client, only update the fields specified in the object. Don't overwrite the entire object.
Additional context
I'd get by if I had access to the publish action's draft, so I could use the spread operator to create the correct object. Something like:
get the most recent draft of the document
Use the client to patch the document like: client.patch('id').set(article: { ...article, publishDate: <new date> })
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm using sanity client to update one field on an object. The only way to update the object is via
client.patch('id').set(fieldName: value})
, but whenvalue
is an object, it overwrites the entire object on the document. Only the field specified would be nice.Describe the solution you'd like
If an object field is set in the client, only update the fields specified in the object. Don't overwrite the entire object.
Additional context
I'd get by if I had access to the publish action's draft, so I could use the spread operator to create the correct object. Something like:
client.patch('id').set(article: { ...article, publishDate: <new date> })
The text was updated successfully, but these errors were encountered: