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

New Attributes Filter block powered by Interactivity API #10812

Closed
Tracked by #42255
roykho opened this issue Sep 1, 2023 · 2 comments · Fixed by #11749
Closed
Tracked by #42255

New Attributes Filter block powered by Interactivity API #10812

roykho opened this issue Sep 1, 2023 · 2 comments · Fixed by #11749
Assignees
Labels
block: filter by attribute Issues related to the Filter by Attribute block. type: enhancement The issue is a request for an enhancement.

Comments

@roykho
Copy link
Member

roykho commented Sep 1, 2023

We want to explore if we can utilize the interactivity API to power the interactions on the frontend for performance gain and better UX.

The filter will live inside a wrapper container called Collection Filters which the initial draft is created #10726

So for now we're creating new experimental filter that lives in assets/js/blocks/collection-filters/inner-blocks

@roykho roykho added type: enhancement The issue is a request for an enhancement. block: filter by attribute Issues related to the Filter by Attribute block. labels Sep 1, 2023
@dinhtungdu
Copy link
Member

We should ensure the new block covers this issue #8608

@dinhtungdu dinhtungdu changed the title Attributes Filter: Interactivity API New Attributes Filter block powered by Interactivity API Oct 18, 2023
@dinhtungdu dinhtungdu self-assigned this Oct 24, 2023
@dinhtungdu
Copy link
Member

Currently, in #11191, Price Filter block defines a block attribute named filterType, Collection Filters block uses that attribute to build the final query for fetching product collection data (attribute count, price range...) from the Store API. To make it easier to write the filter blocks, the Collection Filters block also transforms the collection data into an Interactivity API store, so filter blocks don't have to fetch any data (that's why I called them view block). This works well for the Price Filter but creates an issue for the Attribute Filter block.

Attribute Filter block doesn't only need the store data, but also the term data. This leads to two options:

  • Collection Filters block fetches the term data and passes it down: We will need the Attribute Filter block to define another block attribute, Collection Filters block needs another logic to fetch term data.
  • We fetch the terms inside the Attribute Filter block, violating the view block definition, and potentially making third-party developers confused.

With these options in mind, we can either:

  • Abandon the current direction, and only pass the product collection data down without processing (like we're doing on the trunk) => this is more straightforward and clearer, hence easier for third-party developers to grasp, but the filter blocks are more complex.
  • Continue transforming the product collection data in the Collection Filters block, fetching additional data in filter blocks. This makes filter block implementation simpler and easier to maintain but can be confusing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: filter by attribute Issues related to the Filter by Attribute block. type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants