Repository navigation
Conversation
…ollection in context of Single Product block
Test Results SummaryCommit SHA: ca30928
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. |
…rom-single-product-block-when-used-in-single-product-block
…rom-single-product-block-when-used-in-single-product-block
|
Hi @imanish003, @thealexandrelara, 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: |
thealexandrelara
left a comment
There was a problem hiding this comment.
Great job! I left a comment with a minor improvement proposal, but I'm approving this PR.
✅ All the products are displayed correctly inside the Product Collection (Beta) block
✅ All the products are displayed correctly inside the Product Collection (Beta) block, when the block is included inside the Single Product block.
There are a few things I noticed while testing that I don't think are blockers for this PR, but I wanted to report them to you just in case they haven't been mapped already. I can create separate issues for these if you think it's necessary.
CleanShot.2024-01-31.at.17.00.57.mp4

|
@thealexandrelara Appreciate the review! I'll double-check if this PR introduces the issues you spotted or if they are already on PS. But great catches! I think we're too biased with @imanish003 by constantly working with this block and don't spot such stuff so really good to have fresh eyes looking at the Product Collection! 😅 |
|
@thealexandrelara, I verified the issues you raised and they all exist in
It's been introduced with woocommerce/woocommerce-blocks#12041 while I think the original PR didn't account for Product Collection responsiveness which can break block into two rows.
Product Title is a variation of Gutenberg's post title so that would have to be changed upstream. But personally, I'm not sure if that's a bug or not TBH.
Good spot, issue created: #44255 |
|
Thank you for creating issues for these. Yeah, after testing, I noticed it wasn't something related to these changes, so thank you for double-checking this.
I wonder if we can use the Disabled component in this case, WDYT? |
@thealexandrelara , forgot such a component exists! Here's an issue: #44277. I may tackle those three soon to relax after heavier stuff! Again, appreciate the attention to detail! 🙌 |
… of Single Product block (#44123) * Initial approach to fix incorrect product data displayed in Product Collection in context of Single Product block * Remove the BlockCOntextProvider * Add Block context for title and summary * Add changelog * Improve typing * Add E2E test with Product Collection inside Single Product block * Improve insertBLock function description * Make productPrices selector in Product Collectionmore specific * Extract components props into a types
The initial approach is more like POC. Unfortunately, it has an impact on the performance so won't be a way.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Product Collection (or more technically Product Template) has been using
BlockContextProviderto pass the product context to nested blocks. This was following the core's Query Loop block.However, in Blocks world, many blocks are using
ProductDataContextProvideralong withwithProductHOC. That includes Single Product block and Product Elements (excluding Product Title and Product Summary that are variations of core blocks).Problem:
The problem was that Product Collection displayed content from Single Product block when used in Single Product block (check Before/After below). This is due to:
ProductDataContextProviderset by Single Product parent and wouldn't care aboutBlockContextProviderBlockContextProviderset by Product Template and wouldn't care aboutProductDataContextProviderSolution:
Considering we have inner blocks reacting on two separate contexts we need to pass both of them.
Closes #43991
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Changelog entry
Details
Significance
Type
Message
Comment