Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Conversation

@Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Dec 5, 2019

Fixes #1255 (comment). I also refactored /attribute-filter/block.js a bit because after the changes it was a bit too long so I tried to move some parts to other files.

Screenshots

Peek 2019-12-05 20-54

How to test the changes in this Pull Request:

  1. Create a post with an Attribute Filter and All Products blocks.
  2. In the Attribute Filter enable the Filter Button option.
  3. Preview the post and verify selecting/unselecting options doesn't update the All Products block until you press the Go button.

Changelog

Add option to display a Filter button to Filter Products by Attribute block.

@Aljullu Aljullu added status: needs review type: enhancement The issue is a request for an enhancement. labels Dec 5, 2019
@Aljullu Aljullu requested a review from a team December 5, 2019 20:03
@Aljullu Aljullu self-assigned this Dec 5, 2019
Copy link
Member

@mikejolley mikejolley left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Tested well too.

Added some small items of feedback but pre-approving.

if ( ! blockAttributes.showFilterButton ) {
onSubmit();
}
}, [ checked, onSubmit ] );
Copy link
Member

Choose a reason for hiding this comment

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

Does blockAttributes.showFilterButton need to be a dependency here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I think it's not needed because blockAttributes.showFilterButton can only change in the editor and onSubmit should only be triggered in the frontend.

But that makes me thing that when eluding dependencies we must always explain it in a comment so it doesn't look like a bug. Added in 909a4f9.

help={ () => {
if ( showFilterButton ) {
return __(
'Results will only update when the button is pressed.',
Copy link
Member

Choose a reason for hiding this comment

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

Maybe "products" would be clearer than "results" here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, done in 31ed028.

}
return displayStyle === 'list'
? __(
'Results will update when the options are checked.',
Copy link
Member

Choose a reason for hiding this comment

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

We could probably use the same string here for both, maybe "Products will update as options are selected".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 31ed028 as well.

@Aljullu Aljullu merged commit f7a47e7 into master Dec 6, 2019
@Aljullu Aljullu deleted the add/attribute-filter-submit-button branch December 6, 2019 15:36
@nerrad nerrad added this to the 2.6.0 milestone Jan 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type: enhancement The issue is a request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants