-
Notifications
You must be signed in to change notification settings - Fork 156
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
Follow react rules of hooks #1228
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, just a few nit picks to remove comments that are no longer accurate.
assets/js/gutenberg-plugin.js
Outdated
) { | ||
return null; | ||
} | ||
|
||
// eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. | |
// eslint-disable-next-line no-shadow |
assets/js/gutenberg-plugin.js
Outdated
// eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. | ||
const postType = useSelect( ( select ) => | ||
select( 'core/editor' ).getCurrentPostType() | ||
); | ||
|
||
// eslint-disable-next-line no-shadow, react-hooks/rules-of-hooks -- permission checks are needed. | ||
// eslint-disable-next-line no-shadow -- permission checks are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line no-shadow -- permission checks are needed. | |
// eslint-disable-next-line no-shadow |
assets/js/gutenberg-plugin.js
Outdated
'#wp-admin-bar-distributor' | ||
); | ||
|
||
// eslint-disable-next-line no-shadow -- permission checks are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line no-shadow -- permission checks are needed. | |
// eslint-disable-next-line no-shadow |
assets/js/gutenberg-plugin.js
Outdated
select( 'core/editor' ).getCurrentPost() | ||
); | ||
|
||
// Ensure the user has proper permissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May as well fix the comment style while we're changing this code.
// Ensure the user has proper permissions | |
// Ensure the user has proper permissions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works well 👍
Description of the Change
Follow react rules of hooks
Closes #1205
How to test the Change
Changelog Entry
Credits
Props @kirtangajjar
Checklist: