-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected oneOf re-rendering when filling other schema fields [React Material] #2342
Comments
Hi @andrecchia, Thanks for the detailed report! Much appreciated! It seems we accidentally broke the |
Hi @sdirix, sorry for the very late reply. |
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: jsonforms/packages/core/src/i18n/i18nUtil.ts Lines 181 to 192 in c3cead7
jsonforms/packages/core/src/i18n/i18nUtil.ts Lines 167 to 179 in c3cead7
|
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). |
This commit addresses an issue where array translations were created as new objects within the core module for each render cycle, causing unnecessary rerenders. By memoizing the translation object in the material renderer set, this commit optimizes performance and prevents redundant rerenders. closes eclipsesource#2342
This commit addresses an issue where array translations were created as new objects within the core module for each render cycle, causing unnecessary rerenders. By memoizing the translation object in the material renderer set, this commit optimizes performance and prevents redundant rerenders. closes eclipsesource#2342
This commit addresses an issue where array translations were created as new objects within the core module for each render cycle, causing unnecessary rerenders. By memoizing the translation object in the material renderer set, this commit optimizes performance and prevents redundant rerenders. closes eclipsesource#2342
This commit addresses an issue where array translations were created as new objects within the core module for each render cycle, causing unnecessary rerenders. By memoizing the translation object in the material renderer set, this commit prevents redundant rerenders. This commit also adds memorization to the attributes of the material oneOfRenderer to further avoid unnecessary rerendering. closes eclipsesource#2342
This commit addresses an issue where array translations were created as new objects within the core module for each render cycle, causing unnecessary rerenders. By memoizing the translation object in the material renderer set, this commit prevents redundant rerenders. This commit also adds memorization to the attributes of the material oneOfRenderer to further avoid unnecessary rerendering. closes eclipsesource#2342
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
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
The text was updated successfully, but these errors were encountered: