🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Issue with setting value using custom component in Sanity.io

4 replies
Last updated: Nov 30, 2020
I am trying to set a value with a custom component, but I am getting no response when the
PatchEvent.from(set(value));
executes.
Nov 30, 2020, 3:21 PM
The docs mentions this syntax:
Nov 30, 2020, 3:23 PM
{
  type: 'set' | 'unset' | 'setIfMissing',
  path?: Array<string>,
  value?: any
}

Nov 30, 2020, 3:23 PM
But im not seeing it used in any examples
Nov 30, 2020, 3:23 PM
Hi, sorry for the sparse documentation - we're working on improving this. Do you call your custom input component's
onChange
prop with it anywhere? PatchEvent.from(...) is just a action creator and doesn't do anything on it's own.
There's an example in the render() function here:
https://www.sanity.io/docs/custom-input-widgets#example-implement-a-custom-slider-375a2e4dc198
Nov 30, 2020, 3:34 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?