-
Notifications
You must be signed in to change notification settings - Fork 109
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
feat: enable passing of documentation link to form properties panel #1201
Conversation
c664ff4
to
281cf4d
Compare
const PropertiesPanelHeaderProvider = useMemo( | ||
() => | ||
getPropertiesPanelHeaderProvider({ | ||
getDocumentationRef: propertiesPanelConfig.getDocumentationRef, | ||
formFields, | ||
}), | ||
[formFields, propertiesPanelConfig], | ||
); |
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.
Was this memo really necessary? If you didn't see any noticeable performance issue without it we should remove to avoid memory leaks
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.
Nothing is necessary but not having this means we re-render the whole header every render cycle. Which isn't ideal. It won't lag, yet, but could cause problems down the line.
Basically, this header provider stuff is a config, and we need to keep the reference to the config stable, hence the memo.
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.
@Skaiir Just rerendering is not an issue, as long as rerendering doesn't take long. Also, not all rerenders are committed to the DOM which is usually the most expensive.
But overusing memoization might cause memory leaks as explained here
It's better to only memoize when it's accompanied by some performance issue, and even then most of the time you can easily just restructure your logic.
Related to https://github.com/camunda/team-hto/issues/630