Skip to content

Incubator.Dialog - Fixed content component being created on every render. #3231

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

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

nitzanyiz
Copy link
Collaborator

@nitzanyiz nitzanyiz commented Aug 26, 2024

Description

The new useDialogContent hook was creating a component (DialogContent) on every render and then rendering it. This component is a "new" component every time therefore causing the component to render nonstop.
This could also be solved using useMemo but I don't see any use to it since DialogContent has no state.

Changelog

Incubator.Dialog - Fixed content renders.

Additional info

MADS-4444

@@ -49,7 +49,7 @@ const useDialogContent = (props: InternalDialogCloseButtonProps) => {
return showCloseButton ? [propsContainerStyle, styles.transparent] : propsContainerStyle;
}, [showCloseButton, propsContainerStyle]);

const DialogContent = () => {
const getDialogContent = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename it torenderDialogContent because it's a render method (it returns an element)

@nitzanyiz nitzanyiz enabled auto-merge (squash) August 26, 2024 12:33
@nitzanyiz nitzanyiz merged commit 8207456 into master Aug 26, 2024
1 check was pending
@nitzanyiz nitzanyiz deleted the fix/DialogContent-dynamic-component-creation branch August 26, 2024 12:33
nitzanyiz added a commit that referenced this pull request Aug 26, 2024
…der. (#3231)

* fixed DialogContent component being created on every render and casuing mounts and unmounts

* rename variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants