-
Notifications
You must be signed in to change notification settings - Fork 58
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
Stories block: hide/show based on Editor capability settings being set, only after it's been loaded #2770
Stories block: hide/show based on Editor capability settings being set, only after it's been loaded #2770
Conversation
…when editor settings has already been loading
Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job! |
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.
Working great as expected 🎉
Tested on Android, iOS and unit tests passing locally too
Great job @mzorz ! 🙏
return select( 'core/block-editor' ).getSettings( 'capabilities' ) | ||
.mediaFilesCollectionBlock; | ||
}, [] ); | ||
// eslint-disable-next-line @wordpress/react-no-unsafe-timeout |
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.
Maybe we could write down the reason why are we using a timeout here too for future references
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.
Good idea! added here 6eb17d5
We observed the settings may not be ready exactly when the
native.render
hooks get run but rather right after that execution cycle. Hence, we're only checking for the actual settings to be loaded by usingsetTimeout
without delayTo test:
npm run test src/test/index.js
Note: I've considered and tried adding unit tests for the specific functionality added but, since we haven't found a way to mock select/dispatch easily yet - will get back at this at a later point.
PR submission checklist: