Skip to content

Feat/rst 4852 config to retrieve facet#1935

Draft
victorcg88 wants to merge 5 commits intomainfrom
feat/RST-4852-config-to-retrieve-facet
Draft

Feat/rst 4852 config to retrieve facet#1935
victorcg88 wants to merge 5 commits intomainfrom
feat/RST-4852-config-to-retrieve-facet

Conversation

@victorcg88
Copy link
Contributor

Pull request template

Describe the purpose of the change, the specific changes done in detail, and the issue you have fixed.

Motivation and context

  • Dependencies. If any, specify:
  • Open issue. If applicable, link:

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to not work as expected)
  • Change requires a documentation update

What is the destination branch of this PR?

  • Main
  • Other. Specify:

How has this been tested?

Tests performed according to testing guidelines:

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review on my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

@victorcg88 victorcg88 force-pushed the feat/RST-4852-config-to-retrieve-facet branch from a61786e to 58b61ce Compare November 26, 2025 15:37
@victorcg88 victorcg88 force-pushed the feat/RST-4852-config-to-retrieve-facet branch from 58b61ce to 0a9e9b7 Compare November 26, 2025 16:35
const x = use$x()
const stores = ['Spain', 'Portugal', 'Italy']
const initialExtraParams = { store: 'Portugal' }
const initialExtraParams = { store: 'ES', separateFacets: false }
Copy link
Member

Choose a reason for hiding this comment

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

My 50 cents in naming: isolateFacetsRequest

extraParams: 'extraParams',
extraParams: ({ extraParams: { separateFacets, ...rest } = {} }) => ({
...rest,
facets: !separateFacets,
Copy link
Member

Choose a reason for hiding this comment

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

Thinking in the retrocompatibility of this assertion. ...(!!isolateFacetsRequest && { facets: false }), I think it fits better because the below caustics:

  • isolateFacetsRequest === undefined -> search as always with facets
  • isolateFacetsRequest === false -> search as always with facets
  • isolateFacetsRequest === true -> search without facets
    As I don't know if all search endpoint will give support to this new facets parameter, I prefer to only send this new one where it is "mandatory"

Copy link
Member

Choose a reason for hiding this comment

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

before merging into main: restore this file

Copy link
Member

Choose a reason for hiding this comment

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

before merging into main: restore this file

Copy link
Member

Choose a reason for hiding this comment

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

before merging into main: restore this file

Copy link
Member

Choose a reason for hiding this comment

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

I'm worried about such a deep comparison that we didn't need in the search module...

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking in an alternative approach which could fits better with the current architecture. Let me try to explain that approach:

  • search module keeps handling the request for retrieving facets. Regardless of whether it's against the search or the facets endpoint.
  • All structure in search module keeps remaining but with the casuistic of the new facets endpoint.
  • facets modules keeps remaining a "symbolic" module to handle hard logic as easy
  • Both modules are coupled historically, so the key concept of "you can use a module without the other" is not true in that case. So if search performs the request against facets endpoint, I think it wouldn't be a problem itself. (you only need to check the facets wiring updateFacetsGroupWithSearchFacetsWire to see that coupling)

What are the advantages and disadvantages?

Advantages

  • Not create a "mirror logic" for both modules.
  • Stop making a monster bigger adding new needed properties and logic but without sense with the rest of the module
  • A more reliable feature since it would perform the search logic

Disadvantages

  • facets module should handle their own state/requests
  • Could we need in the future X for only facets without search?

TL;DR If we invest time in refactor deeply the facets module to make it real module isolation (refactor and understanding), go with requests in facets module and self-management (breaking changes coming...). If not, search remains responsible for retrieving facets from search or facets endpoint.

@joseacabaneros
Copy link
Member

joseacabaneros commented Jan 15, 2026

Conversation from 15/01/26 @victorcg88 & @joseacabaneros
Options:

  • Nothing: Leave as it is and copy-paste CDL code to other customers -> Close this PR and X as always
  • Intermediate 1: search module keeps knowing how request facets (from search or facets endpoints) -> New PR with "few" changes
  • Intermediate 2: facets module request to endpoint and side effects to make it works -> This PR
  • Complete: Decouple totally search and facets modules, and each one knows how to request their data. The more difficult and the best one. -> Similar PR to this one but with more changes or "breaking changes"

Decision Going ahead with this PR (Intermediate 2) to avoid spending more time in an "intermediate" solution due to we have no time to invest in the complete solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants