-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Use feature the new feature flags engine to guard the access to the new product blocks experience #37122
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
Conversation
27b55cb to
35b22fe
Compare
Test Results SummaryCommit SHA: 4dbbe54
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #37122 +/- ##
===========================================
- Coverage 51.6% 46.7% -4.9%
+ Complexity 17444 17187 -257
===========================================
Files 440 429 -11
Lines 80297 64824 -15473
===========================================
- Hits 41401 30255 -11146
+ Misses 38896 34569 -4327 |
louwie17
left a comment
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.
Nice work @mdperez86, in the end I do think it makes sense to keep the original feature flag around (as users did have the opportunity to enable it).
I think it would be beneficial to add a banner component to that screen that it will be replaced by the other block component in the near future (maybe one release).
I also left a couple other code suggestions to update some logic in a couple places and to also keep this feature flag disabled by default (for now).
| 'disable_ui' => false, | ||
| ), | ||
| 'new_product_management' => array( | ||
| 'new_product_management' => array( |
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.
I think we could remove this feature now, given it was disabled anyway and just replace it with the one below.
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.
As mentioned above, on second thought I think it would be better to keep it for at-least one release.
| 'name' => __( 'New product management experience', 'woocommerce' ), | ||
| 'description' => __( 'Try the new product management experience with Gutenberg Blocks (Alpha)', 'woocommerce' ), | ||
| 'is_experimental' => 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.
I think on line 417:
woocommerce/plugins/woocommerce/src/Internal/Features/FeaturesController.php
Lines 417 to 419 in 87f51d9
| } elseif ( 'new_product_management' === $feature_id ) { | |
| return NewProductManagementExperience::TOGGLE_OPTION_NAME; | |
| } |
You either want to update that condition to use
new_product_management_blocks or add an or case. At-least that way the current feature flag that we toggle using the beta tester still works.
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.
We probably also want to update this condition:
woocommerce/plugins/woocommerce/src/Internal/Features/FeaturesController.php
Lines 665 to 668 in 87f51d9
| if ( 'new_product_management' === $feature_id ) { | |
| $disabled = true; | |
| $desc_tip = __( '⚠ This feature will be available soon. Stay tuned!', 'woocommerce' ); | |
| } |
So the blocks feature is also disabled by default (for now).
| } | ||
| } else if ( | ||
| window.wcAdminFeatures[ 'new-product-management-experience' ] | ||
| ) { |
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.
I think we could remove this else if condition if we just replace the current feature flag with the other one.
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.
Hmm on second thought, users are able to enable it in the last released WooCommerce version, so we probably do want to keep this around for at-least one release.
We may want to add a big banner to the old UI also that it will be replace by the other feature in the next release?
db12e28 to
d05cc89
Compare
|
This PR is |
|
|
||
| if ( window.wcAdminFeatures[ 'new-product-management-experience' ] ) { | ||
| pages.push( { | ||
| if ( isFeatureEnabled( 'new_product_management_blocks' ) ) { |
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.
Just noting that I have a PR waiting review that updates the feature name. #37339
| $settings['connectNonce'] = wp_create_nonce( 'connect' ); | ||
| $settings['wcpay_welcome_page_connect_nonce'] = wp_create_nonce( 'wcpay-connect' ); | ||
|
|
||
| $settings['features'] = $this->get_features(); |
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.
It feels like we have 2 sources of truth for features now between this and wcAdminFeatures.
I like that this new set includes more information around the feature, but curious if the plan to eventually phase the old one out?
|
@mdperez86 could we update this PR to replace the woocommerce/plugins/woocommerce/src/Internal/Features/FeaturesController.php Lines 643 to 653 in 0d45b0f
Let me know if it is easier to close this PR and start a new? |
|
Hi @louwie17, Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
|
@louwie17 I have 2 questions here.
|
Hmm yeah, that wasn't quite what I intended. This is still technically a feature, so we can just enable it within the
In relation to the first question and answer, we can keep this here and not move this. Once the product editor isn't a feature anymore (not toggle able in settings) we can remove it from the |
|
@mdperez86 just a heads up that I did update your PR a slight bit, by keeping the |
…elper, and enable product block editor feature.
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 and approving so we can get this in before the code freeze.
/wp-admin/admin.php?page=wc-admin&path=/add-product-old
Noting that the old editor does not show up here, but I don't think we should be showing the "old new editor" since we're considering this an iteration on that experience and it never left beta.
Also as mentioned earlier, I don't like that we have 2 very similar but slightly different APIs for features on both the frontend and backend now. These two are semantically indistinguishable so we should either move towards separating them further if they really are different or consolidating them if they house similar logic. Let's get some issues open to address this technical debt before it becomes a bigger issue.
Previous in meeting agreement on this
All Submissions:
Changes proposed in this Pull Request:
Closes #36989
How to test the changes in this Pull Request:
/wp-admin/admin.php?page=wc-admin&path=/add-productor/wp-admin/admin.php?page=wc-admin&path=/product/{productId}you should see the previous product experience.New product management experienceinWooCommerce -> Settings -> Advanced -> Featuresand visiting back the urls of point 1, you should see the new product editor blocks. And the previous product experience remains accessible using/wp-admin/admin.php?page=wc-admin&path=/add-product-oldor/wp-admin/admin.php?page=wc-admin&path=/product-old/{productId}routes.Other information:
pnpm --filter=<project> changelog add?FOR PR REVIEWER ONLY: