Skip to content
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

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

Skaiir
Copy link
Contributor

@Skaiir Skaiir commented Jun 6, 2024

@Skaiir Skaiir requested a review from vsgoulart June 6, 2024 10:15
@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Jun 6, 2024
@Skaiir Skaiir changed the base branch from main to develop June 6, 2024 10:15
@Skaiir Skaiir force-pushed the thto-630-form-documentation-ref branch from c664ff4 to 281cf4d Compare June 6, 2024 12:02
Comment on lines +90 to +97
const PropertiesPanelHeaderProvider = useMemo(
() =>
getPropertiesPanelHeaderProvider({
getDocumentationRef: propertiesPanelConfig.getDocumentationRef,
formFields,
}),
[formFields, propertiesPanelConfig],
);
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@vsgoulart vsgoulart Jun 6, 2024

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.

@Skaiir Skaiir merged commit 8480da6 into develop Jun 6, 2024
11 of 12 checks passed
@Skaiir Skaiir deleted the thto-630-form-documentation-ref branch June 6, 2024 16:43
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants