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

Remove useMemo in component export, refactor MetadataDisplay component #646

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

Dananji
Copy link
Collaborator

@Dananji Dananji commented Sep 18, 2024

Related issue: #630

Refactor MetadataDisplay component's calculated UI portions to re-render only when relevant state variables are changed using React.useMemo hook.
Use the same concept in other mostly static components refactored in #640, instead of wrapping the component export in React.useMemo.
The implementation in #640 with React.useMemo was still emitting a warning react-styleguidist docs regardless of the styleguidist config changes. And with this implementation we can still limit the re-renders to the entire component and export pure components for react-styleguidist to use to generate documents.

Copy link
Member

@cjcolvar cjcolvar left a comment

Choose a reason for hiding this comment

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

Looks great!

@Dananji Dananji merged commit 44ea757 into main Sep 20, 2024
2 checks passed
@Dananji Dananji deleted the state-refactor3-630 branch September 20, 2024 16:40
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