Skip to content
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 Collection: disable "Sync with current query" option for 2nd+ block in product archive #44577

Conversation

kmanijak
Copy link
Contributor

Submission Review Guidelines:

Changes proposed in this Pull Request:

There's a "Sync with current query" option available on Product Collection block (Product Catalog collection). Till now the option was enabled by default on product archives. This PR introduces the logic that the option is enabled ONLY IF there's no other Product Collection block that already syncs with query.
In other words, the rule of thumb is:

  • first Product Collection (Product Catalog) on a page will get the option enabled by default
  • second and next will get the option disabled.

Closes #44086

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

Scenario 1

  1. Go to Product Catalog template
  2. Add Product Collection (Beta) block
  3. Choose "Featured" collection - this step is to make sure "other" collections don't influence the solution
  4. Add Product Collection (Beta) block
  5. Choose "Product Catalog" collection
  6. Expected: Check inspector controls - "Sync with current query" should be ENABLED
image
  1. Add Product Collection (Beta) block
  2. Choose "Product Catalog" collection
  3. Expected: Check inspector controls - "Sync with current query" should be DISABLED
image

Scenario 2

  1. Go to Product Catalog template
  2. Add Product Collection (Beta) block
  3. Choose "Featured" collection - this step is to make sure "other" collections don't influence the solution
  4. Add Product Collection (Beta) block
  5. Choose "Product Catalog" collection
  6. Expected: Check inspector controls - "Sync with current query" should be ENABLED
  7. Disable the option
  8. Add Product Collection (Beta) block
  9. Choose "Product Catalog" collection
  10. Expected: Check inspector controls - "Sync with current query" should be ENABLED because we disabled the option in previous one

Scenario 3

  1. Create new post
  2. Add Product Collection (Beta) block
  3. Choose "Featured" collection
  4. Add Product Collection (Beta) block
  5. Choose "Product Catalog" collection
  6. Expected: Check inspector controls - "Sync with current query" option is not available
  7. Switch to Code Editor view (Three dots menu in top right corner of Editor -> Code Editor)
image
  1. Search for "inherit" and make sure it's false
image

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@kmanijak kmanijak added type: enhancement The issue is a request for an enhancement. team: Kirigami & Origami block: product collection Issues related to the Product Collection block labels Feb 13, 2024
@woocommercebot woocommercebot requested review from a team and thealexandrelara and removed request for a team February 13, 2024 10:52
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 13, 2024
Copy link
Contributor

Hi @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:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

github-actions bot commented Feb 13, 2024

Test Results Summary

Commit SHA: ccaf4fc

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests300004003408m 44s

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.

Copy link
Contributor

@thealexandrelara thealexandrelara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work so far! I left two minor suggestions regarding the title of the tests. Here are the testing results:

⛔ Scenario 1: After adding the last Product Collection (Beta) block, the "Sync with current query" is not disabled:

CleanShot.2024-02-15.at.12.55.35.mp4

✅ Scenario 2: After adding the last Product Collection (Beta) block, the "Sync with current query" setting of the last added block is enabled.

CleanShot.2024-02-15.at.13.05.00.mp4

✅ Scenario 3: When I add the Product Collection (Beta) block to a new post, the ""Sync with current query" option is not available. If I switch to the Code Editor view, the "inherit" is set to false.

CleanShot.2024-02-15.at.13.06.51.mp4

kmanijak and others added 2 commits February 16, 2024 08:42
@kmanijak
Copy link
Contributor Author

@thealexandrelara , thanks for a review! I addressed minor comments 👍

⛔ Scenario 1: After adding the last Product Collection (Beta) block, the "Sync with current query" is not disabled:

TBH I can't reproduce it at all. Is there any chance the project didn't rebuild on your side? I'm asking because scenarios 2 and 3 are only regression scenarios, meaning they would pass on trunk as well and only scenario 1 is new feature covered in that PR. I'd be grateful for double-checking 🙏

@thealexandrelara
Copy link
Contributor

@thealexandrelara , thanks for a review! I addressed minor comments 👍

⛔ Scenario 1: After adding the last Product Collection (Beta) block, the "Sync with current query" is not disabled:

TBH I can't reproduce it at all. Is there any chance the project didn't rebuild on your side? I'm asking because scenarios 2 and 3 are only regression scenarios, meaning they would pass on trunk as well and only scenario 1 is new feature covered in that PR. I'd be grateful for double-checking 🙏

I tried rebuilding or creating a JN site from this branch, but still getting the same results, unless I'm doing something wrong while testing or there is some requirement that I'm missing. I'm going to send the JN site credentials to you in private :)

@kmanijak
Copy link
Contributor Author

I tried rebuilding or creating a JN site from this branch, but still getting the same results, unless I'm doing something wrong while testing or there is some requirement that I'm missing

@thealexandrelara , I tested adding blocks on a higher level, while you tested with nested blocks. I misread one selector documentation I didn't notice it wouldn't work for nested blocks. I revisited implementation. May I ask you for yet another review? 🙏

Copy link
Contributor

@thealexandrelara thealexandrelara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Thank you for addressing all the raised points. I just tested it and everything is working as expected. 🚀

@kmanijak kmanijak merged commit 5b42015 into trunk Feb 19, 2024
56 checks passed
@kmanijak kmanijak deleted the 44086-product-collection-disable-sync-with-current-query-for-2nd+-block branch February 19, 2024 16:51
@github-actions github-actions bot added this to the 8.7.0 milestone Feb 19, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 19, 2024
@Stojdza Stojdza added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Feb 20, 2024
@kmanijak kmanijak changed the title Product Collection: disable "Sync with current query" option for 2nd+ block on archive Product Collection: disable "Sync with current query" option for 2nd+ block in product archive Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block: product collection Issues related to the Product Collection block needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris team: Kirigami & Origami type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Product Collection: disable "Sync with current query" for 2nd+ block
3 participants