Skip to content

Remove useMemo in component export, refactor MetadataDisplay component - #646

Merged
Dananji merged 1 commit into
mainfrom
state-refactor3-630
Sep 20, 2024
Merged

Remove useMemo in component export, refactor MetadataDisplay component#646
Dananji merged 1 commit into
mainfrom
state-refactor3-630

Conversation

@Dananji

@Dananji Dananji commented Sep 18, 2024

Copy link
Copy Markdown
Collaborator

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.

@cjcolvar cjcolvar left a comment

Copy link
Copy Markdown
Member

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
@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