-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
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> })
Metadata
Metadata
Assignees
Labels
No labels