-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
[Product Block Editor]: implement Choose products for me
button
#43520
[Product Block Editor]: implement Choose products for me
button
#43520
Conversation
Hi , @woocommerce/mothra 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: |
Test Results SummaryCommit SHA: 06239ff
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. |
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.
Overall this tested well, but I noticed an issue with the discrepancy between the two data stores.
If I create a new product and click 'choose products for me' and then go to add specific categories and save the product and click 'choose products for me' I still get the same list, versus the new list that comes with the new categories.
I left an inline comment with some thoughts.
packages/js/product-editor/src/blocks/generic/linked-product-list/edit.tsx
Outdated
Show resolved
Hide resolved
|
||
const relatedProducts = ( await getRelatedProducts( | ||
productId | ||
) ) as Product[]; |
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 did notice one issue with this, for saving the product we use the core entity data store, but for this selector we are using our product data store. This means that when a user save the product by adding categories and then clicks getRelatedProducts
we get the same result instead of the updated one's.
Should we either make use of the core entity data store as well? or add an invalidation method when we save the product, so we also invalidate our products data store?
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.
👁️ looking
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 don't know if we can use the core store. Is the related prop (related_ids
) exposes by code? Maybe we can tweak the selector deps to invalidate its data.
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.
You should be able to use useEntityProp
and get the related_ids
that way
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.
Thanks for the updates @retrofox, this is testing well, nice work!
Submission Review Guidelines:
Changes proposed in this Pull Request:
This PR implements the
Choose products for me
button for the Upsells and Cross-sells sections of the Linked Product tab.Part of #42922
Closes # .
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Tools
->WCA Test Helper
Features
tabproduct-linked
featureChoose products for me
button in the Linked product sectionsScreen.Recording.2024-01-11.at.13.44.16.mov
Changelog entry
Significance
Type
Message
Comment