-
Notifications
You must be signed in to change notification settings - Fork 377
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
Fix/remove are equal #1814
Fix/remove are equal #1814
Conversation
6d2ed8b
to
3e7271a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it very much and could barely find any problems.
The ExpandPanelRenderer
should also be placed in a React.memo
and it's methods moveUp
etc. should be placed in useCallbacks
. At the moment an ExpandPanel rerenders even when only a control in a sibling changes, this can be checked via the "array with detail" example.
Also other renderers are missing their memo. For example the DateControl. Please check that all controls now have a memo.
Please also add to the migration guide for JSON Forms 3.0 that custom renderers now need to be memoized by themselves as it's no longer automatically included in the bindings, e.g. withJsonFormsControlProps
. Show an example of how it now should look like.
dacc020
to
51732e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Found a bug, a missing debounce and some unnecessary useMemo
and useCallback
s.
I went with a profiler over the examples. I saw that in nested arrays unrelated expand panels are rerendered even when nothing in their content changes (not at all of them as at some point the content renders a memoized renderer again). Maybe there is some optimization potential.
Some enum table cells also seem to render unnecessarily often, seemingly related to the options
object.
I'm fine extracting these issues into a follow up if there is not enough time for them in this task.
packages/material/src/layouts/MaterialCategorizationStepperLayout.tsx
Outdated
Show resolved
Hide resolved
51732e2
to
096815f
Compare
74c0a67
to
47f5a74
Compare
Due to previous refactorings data instance references only change on update when their actual content changed. Therefore the manual memoization comparison functions ("areEqual") involving deep equals are no longer necessary. Other props which changed with each rerendering, like the enum "options" objects or the array dispatch methods are now also properly memoized. Includes minor additional changes like refactoring all remaining React Material renderers to functional compoonents, generalizing the React bindings and memoizing intermediate components.
47f5a74
to
46e16e7
Compare
The React Vanilla renderers add additional bindings for style customizations. The calculated props are now properly memoized so that the standard React memoization can take effect.
46e16e7
to
eb774aa
Compare
No description provided.