Open andrecchia opened 5 months ago
Hi @andrecchia,
Thanks for the detailed report! Much appreciated!
It seems we accidentally broke the memo
barrier somewhere in between the versions. Did you already check via the React Dev Tooling which prop is responsible for the rerendering of our components?
Hi @sdirix, sorry for the very late reply. Actually I tried but I could not get the responsible of the rerendering, I am not so used to React Dev Tooling. I plan to check for it again since in these days I am debugging my application, I will get you updated.
This error occurs in the OnOf-renderer and the Array-renderer. They use a set of translated texts (e.g. for the confirmation dialog). But we create a new translations object each time when mapping the JSONforms state to component props in the core module: https://github.com/eclipsesource/jsonforms/blob/c3cead71d08ff11837bdeb5fbea66e5313137218/packages/core/src/i18n/i18nUtil.ts#L181-L192
Good find. This means we need to handle them differently in the bindings to avoid breaking the memo barrier. Either by customizing the memo handling or by binding them separately (in a transparent fashion).
Describe the bug
Starting from version 3.2.0, with React Material renderers, I observed that any keyboard input in any field triggers a rerender of the oneOf elements.
Expected behavior
The oneOf elements should rerender only when there is keyboard input within their own fields, as was happening in version 3.1.0
Steps to reproduce the issue
Add this
src/CustomText
renderer that wraps theMaterialTextControl
inserting aMath.random()
to make the rerendering evidentsrc/schema.json
with this, containing a text field and a oneOf:CustomText
renderer{ tester: customTextTester, renderer: CustomText }
tosrc/App.tsx
's array of renderers, comment theuischema
inJsonForms
element (the default uischema is enough)Test Text
field and observe that everything is rerendering, oneOf included, even if there should be no reason for the oneOf to rerendergit checkout 3ed669c5e6434919b090c7c9981f3c9a643c125c
, and reinstall the dependenciesnpm install
; repeat the steps at the previous point and observe that when fillingTest Text
there is no oneOf rerendering, as it should be.Screenshots
No response
Which Version of JSON Forms are you using?
v3.3.0
Framework
React
RendererSet
Material
Additional context
No response