I’m trying to add a custom renderer for a particular path in my schema:
export default rankWith(3, schemaSubPathMatches('productOnTenant'))
and I want it to match
#/properties/productOnTenant/properties/ but it doesn’t match for some reason. Any idea why?
Also, how would one generate an editor for a dictionary? As in, an object whose props are dynamic/vary.
[original thread by Georgios Diamantopoulos]
schemaSubPathMatches expects a second parameter with a predicate. The idea is to conveniently check a nested property of the the element which is to be matched.
If I understand your use case correctly to match on all properties nested in
productOnTenant, then you can simply write your own tester, e.g.
const MyTester = (uischema) => uischema.scope.startsWith(`#/properties/productOnTenant/properties/`);
In the end each
Tester just takes
schema as parameters and returns a boolean. So you can check whatever you like. Would this also cover your dynamic use case?
Sounds good, thank you. It’d be great to add all that to the docs
If jsonforms is lagging while editing, I should check for re-renders in the parents, right?
I see you already opened the rerender issue. Just note that we have a “known” performance problem when doing many edits (e.g. typing fast in a text control) in large forms as the whole data object is validated and a rerender triggered (which mostly should result in memoized cache returns) on every keystroke. For these cases we would like to implement a debounce mechanism, so the whole cycle is not executed so often. See this question for more information.