Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(ui): allow json fields to be updated externally #11371

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

JarrodMFlesch
Copy link
Contributor

@JarrodMFlesch JarrodMFlesch commented Feb 24, 2025

What?

Unable to update json fields externally. For example, calling setValue on a json field would not be reflected in the admin panel UI.

Why?

JSON fields use the monaco editor to manage state internally, so programmatically updating the value in state does not change the internal value.

How?

Set a ref when the user updates the value and then unset the ref after the change is complete.

Inside the hook that watches value, if the value changed and the change came from the system (i.e. a programmatic change) refresh the editor by adjusting its key prop. If the change was made by the user, there is no need to refresh the editor.

Fixes #10819

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useField setValue does not visually update JSON field in UI
1 participant