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

Add: Active Filters block powered by Interactivity API #42008

Merged
merged 11 commits into from Dec 19, 2023

Conversation

dinhtungdu
Copy link
Member

@dinhtungdu dinhtungdu commented Dec 11, 2023

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #42179 .

How to test the changes in this Pull Request:

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

  1. Add the Collection Filters block into a Product Collection block.
  2. See the Collection Active Filters and other filter blocks added along with the Collection Filters block.
  3. Toggle the display style, see the editor reacts.
  4. Save and test the block on the frontend:
  • It's hidden when no filter applied.
  • It's visible when a filter is applied.
  • Clicking on the remove button of each active filter removes that filter from the URL and update the products grid as well as the corresponding filter block.
  • Clicking on the Clear All button remove all filters.
  • Removing a filter from the filter block also remove the corresponding one from the active filter block.
  • See chip and list style work as expected.

Note that the price filter nêd to be updated to use context instead of state to make it work properly with Clear All button.

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

Add new Active Filters block powered by Interactivity API.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Dec 11, 2023
@dinhtungdu dinhtungdu added focus: blocks block-type: filter blocks Issues related to all of the filter blocks. block: active filters Issues related to the Active Filters block. labels Dec 11, 2023
Copy link
Contributor

github-actions bot commented Dec 11, 2023

Test Results Summary

Commit SHA: 43a05a2

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

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

Hi @samueljseay,

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

@dinhtungdu dinhtungdu force-pushed the add/interactive-active-filters-block branch 2 times, most recently from 293140f to bf4044f Compare December 13, 2023 03:25
@dinhtungdu dinhtungdu marked this pull request as ready for review December 13, 2023 03:32
@dinhtungdu dinhtungdu force-pushed the add/interactive-active-filters-block branch from eadfd91 to c94ab40 Compare December 13, 2023 04:29
@dinhtungdu dinhtungdu force-pushed the add/interactive-active-filters-block branch from c94ab40 to 6980650 Compare December 13, 2023 04:56
@dinhtungdu dinhtungdu force-pushed the add/interactive-active-filters-block branch from 1ce377a to 2c6175d Compare December 13, 2023 08:23
@dinhtungdu dinhtungdu self-assigned this Dec 13, 2023
@dinhtungdu dinhtungdu marked this pull request as draft December 13, 2023 09:04
@dinhtungdu dinhtungdu force-pushed the add/interactive-active-filters-block branch 2 times, most recently from 6c92ccb to d14e42d Compare December 14, 2023 09:22
@dinhtungdu dinhtungdu marked this pull request as ready for review December 14, 2023 09:40
Copy link
Contributor

@samueljseay samueljseay left a comment

Choose a reason for hiding this comment

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

Tests well for me. Just some nitpicks mainly. 🚢

*/
import { BlockEditProps } from '@wordpress/blocks';

export type BlockAttributes = {
Copy link
Contributor

Choose a reason for hiding this comment

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

So I've been following this pattern too, mainly due to copy/paste, but do we really need separate file to declare types like this? i think it can live with the block?

nitpick really, it doesn't matter too much

Copy link
Member Author

Choose a reason for hiding this comment

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

If we don't use attribute outside of the edit component, then we don't need this file. But usually, we need to use block attributes and/or edit props in other components, then a separate file makes more sense to me. Because it's something happy more often than not, I think following the 'convention' (even when the attribute is used only in one place) make it easier for every one working on the source.

@dinhtungdu dinhtungdu force-pushed the add/interactive-active-filters-block branch from 1646a14 to b74b6c7 Compare December 19, 2023 04:44
Copy link
Contributor

@samueljseay samueljseay left a comment

Choose a reason for hiding this comment

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

One nitpick suggestion from me 😄 pre-approving

@dinhtungdu
Copy link
Member Author

E2E tests passed after one retry. Merging.

@dinhtungdu dinhtungdu merged commit c651b10 into trunk Dec 19, 2023
30 checks passed
@dinhtungdu dinhtungdu deleted the add/interactive-active-filters-block branch December 19, 2023 10:29
@github-actions github-actions bot added this to the 8.5.0 milestone Dec 19, 2023
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Dec 19, 2023
@alopezari alopezari 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 Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block: active filters Issues related to the Active Filters block. block-type: filter blocks Issues related to all of the filter blocks. 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Active Filter block powered by Interactivity API
4 participants