RFC 125: UI Modification for Forge Custom Fields

Thanks a lot for the thoughtful question – this is exactly the kind of feedback we were hoping for on the RFC.

Why the callback-style example?

You’re absolutely right that a promise-based version works well in React hooks and gives clearer error‑handling options.

In our example, we used a callback-style form to emphasise the reactive behaviour: customFieldApi.getFieldData(handler) is intended to:

  • Provide the initial field data, and

  • Re‑invoke the handler whenever the field value changes via UI Modifications.

So the intent is closer to “subscribe to updates” rather than a single one‑off “get”. We’ll think about how to make this reactive / subscription behaviour clearer in the documentation.

It’s also perfectly reasonable for app developers to build their own React custom hooks on top of this – for example, useFieldData or useFieldValue hooks that internally call customFieldApi.getFieldData and expose whatever interface (including promise-style helpers) best fits their app.

In the RFC snippet, setFieldValue is the standard React state setter from useState. The examples have now been updated to show the full context. This is meant to illustrate how you’d wire the subscription into React state, and how setFieldValue is defined.