-
Notifications
You must be signed in to change notification settings - Fork 799
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
Add Jetpack Modules redux store to shared utils #33397
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Could use a .md with docs and examples/usage |
@CGastrell Thanks for pointing this out. Added basic Readme. However, we might change it a bit in the future, providing a more accessible experience utilizing the hooks. |
@jeherve oh, I haven't got this from the first time. Thanks, I'll take a look. |
@jeherve Sorry it took so long, due to ongoing support rotation. I pushed I believe a fix for this situation. The only thing does Atomic also considered simple? I'm wiring my logic around |
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.
The only thing does Atomic also considered simple? I'm wiring my logic around isSimpleSite() which I hope should be sufficient.
isSimpleSite()
should be enough indeed! That's also what we do in useModuleStatus
:
jetpack/projects/js-packages/shared-extension-utils/src/hooks/use-module-status/index.js
Lines 47 to 50 in ef15d7e
// On WordPress.com Simple sites, all modules are always active. | |
if ( isSimpleSite() ) { | |
return true; | |
} |
@@ -42,6 +43,10 @@ export function* updateJetpackModuleStatus( settings ) { | |||
* @returns {object} - an action object. | |||
*/ | |||
export function* fetchModules() { | |||
// We don't fetch modules for Simple Site and aknowledge that all modules are active | |||
if ( isSimpleSite() ) { | |||
return true; |
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.
Shouldn't it return an object instead, to match the expected return?
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.
Oh, good catch. Though, it's error in JSDoc, it should yield
object but returns bool
.
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 tests well for me. 🚢 !
Fixes https://github.com/Automattic/vulcan/issues/12
Proposed changes:
In order to have a consistent state of Modules statuses across Monorepo I think it would be beneficial to have a Modules Redux store. This eventually could replace (or enhance) hook
useModuleStatus
and give more information.shared-extension-utils
dispatch
action to control the module state within Form package (and block)withAiAssistantComponents
HOC to useuseIsPossibleToExtendJetpackFormBlock
hook to have reactive dataOther information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
/wp-admin/admin.php?page=jetpack_modules
verify that Contact Form module is disabled/wp-admin/post-new.php
and add new block