Hey
What is the preferred way to update jsonSchema and uiSchema dynamically outside of JsonForms component?
At the moment I’m storing jsonSchema&uiSchema values in a React.useState and I modify them via the setter function.
It works, although:
Am I not reinventing the wheel here? Is there any preferred built-in way to do that via JsonForms libs?
I’m a bit concerned about performance in my approach, as modifying schemas triggers JsonForms parent rerender. Seems like this might ruin any optimizations provided by JsonForms lib
Storing and modifying the schema and uiSchema outside of JSON Forms is completely fine. Whenever you update them, all elements which have a new object identity will rerender.
This depends a bit in your use case. What is the reason that you modify the schema and uiSchema on the fly and how often does it happen?
Im doing something similar to JSON Forms Editor (jsonforms-editor.netlify.app)
So, I need to dynamically modify schema to add form fields and modify uiSchema to modify (is required, labels, styles, etc.) them on the fly.
So there might be quite a few of inputs.
I think that’s fine then. If you make sure that the schema and uischema are not full deep copies then you can save a bit on performance. But it’s sufficient to worry about that once you actually run into performance issues.