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

[core] memoize context values for react/jsx-no-constructed-context-values #34849

Merged
merged 5 commits into from
Oct 28, 2022

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Oct 22, 2022

Memoize context values to satisfy eslint for #34642

Together with #34846 this concludes most fixes for: #34642

@Janpot Janpot added the core Infrastructure work going on behind the scenes label Oct 22, 2022
@mui-bot
Copy link

mui-bot commented Oct 24, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-34849--material-ui.netlify.app/

Details of bundle changes

Generated by 🚫 dangerJS against 68e9de0

@Janpot Janpot marked this pull request as ready for review October 24, 2022 08:47
Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this!

Comment on lines 98 to 101
if (disabled && focused) {
// NOTE: Setting state during render?
setFocused(false);
}
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this should be in a useEffect. Good catch.

Suggested change
if (disabled && focused) {
// NOTE: Setting state during render?
setFocused(false);
}
React.useEffect(() => {
if (disabled && focused) {
setFocused(false);
}
}, [disabled, focused]);

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened a separate PR #34916

@Janpot Janpot merged commit 04a6145 into mui:master Oct 28, 2022
@Janpot Janpot deleted the stable-context branch October 28, 2022 18:53
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
feliperli pushed a commit to jesrodri/material-ui that referenced this pull request Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants