I've created a ui Field that's a button to update the contents of a json Field.
However, when I click the custom button, the monaco editor component that Payload uses doesn't seem to refresh to reflect the new value.
If I hit save after I click the button, the new value is there, so it does seem to be successfully updating the field.
import { Button } from 'payload/components';
import { useField } from 'payload/components/forms';
import React from 'react';
export default function SyncButton() {
const { value: content, setValue: setContent } = useField<string>({ path: 'content' });
function syncContent() {
setContent({ foo: 'bar' });
}
return (
<Button onClick={syncContent} buttonStyle='secondary'>
Sync Content
</Button>
);
}
This does not seem to set the field though.