-
Notifications
You must be signed in to change notification settings - Fork 25
add data prop and rerender FAQ #280
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
Conversation
sdirix
left a comment
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.
Some comments
content/faq/faq.mdx
Outdated
| Like most React components, JSON Forms will revalidate and rerender whenever a new object is passed to it. | ||
| To reduce unnecessary rerenders and optimize your application's performance, any prop handed over to JsonForms in React should be either stable or memoized. |
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.
We should elaborate a bit here:
- JSON Forms uses React.memo, so to avoid any unnecessary rerenderings only stable properties should be handed over
Some specifics:
- Handing over a new
schemaprop will revalidate and rerender - Handing over a new
dataprop will revalidate and rerender, except for if it's thedatawhich was emitted byonChange - Handing over a new
onChangeis fine as neitherrerendernorrevalidatewill be triggers - Handing over a new
i18nis fine, as long as the properties are stable. - validationMode change might trigger a revalidation and rerender
- Handing over anything else new will potentially lead to a
rerender.
d82166c to
62e13c8
Compare
sdirix
left a comment
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!
closes eclipsesource#214 Co-authored-by: Stefan Dirix <sdirix@eclipsesource.com>
closes #214