shopware / frontends

Shopware Frontends is a framework for building custom, headless storefronts with Shopware 6.
https://frontends.shopware.com
MIT License
176 stars 49 forks source link

[FEATURE] Refactor listing composable #841

Open patzick opened 7 months ago

patzick commented 7 months ago

Description

useListing composable is complicated and introduces errors for different useCases. We should split it from search listing context and provide separate solutions.

Use Case

For the context of this issue we should propose new API for listing and deprecate old solution.

Proposed Solution

No response

Alternatives Considered

No response

Additional Context

No response

BrocksiNet commented 4 months ago

WIP:

What I, as a Buyer (Website User), expect from a product listing:

What I, as a shop owner, expect from a product listing:

mkucmus commented 4 months ago

loose proposal

since there is no way to have more product listings than 1 at the same cms page, maybe we could consider splitting up the useListing by it's areas, sharing the same state/context:

image

pros:

cons:

BrocksiNet commented 4 months ago

What I also have in mind is that we could push the Core team a bit to fix this issue, or someone with PHP skills from our team could suggest not loading Products on CMS (via a Flag). That would speed up the CMS Request and allow us to load our listing as needed.

BrocksiNet commented 1 month ago

Copied description from #1057

Problems:

Filters are changed after refreshing the page. This problem exists because we are building it at the init page request. After applying any filter, the context changes, and we do not refresh the list. To decide what strategy should be implemented

What we need:

Only one function will handle API calls (currently, we have two different calls. From search.vue and useListing composable

We should send two requests. Init a request to give us all available filters for searching and the next one to get active filters.

Change the structure of the filter request. It should be a part of the filter property.

Add examples of how to use listing/search filters with different variants