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

feat(commerce): clean up now replaced controllers #3857

Merged
merged 11 commits into from
May 8, 2024

Conversation

Spuffynism
Copy link
Contributor

@Spuffynism Spuffynism commented Apr 25, 2024

See commerce.index.ts to understand the scope of the changes. We remove top-level pagination, sort and facet generator controllers, in favor of those accessible through sub-controllers.

This PR is part of a series of cascading PRs: #3842

CAPI-719

@Spuffynism Spuffynism requested review from a team as code owners April 25, 2024 15:38
@Spuffynism Spuffynism requested review from olamothe, louis-bompart and fbeaudoincoveo and removed request for a team April 25, 2024 15:38
Copy link

github-actions bot commented Apr 25, 2024

Pull Request Report

PR Title

✅ Title follows the conventional commit spec.

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 202.6 202.6 0
commerce 267.8 266.3 -0.5
search 364.9 364.9 0
insight 345.5 345.5 0
product-listing 257.9 257.9 0
product-recommendation 171.6 171.6 0
recommendation 215.5 215.5 0
ssr 357.8 357.8 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
product-recommendation 0 10 0
product-listing 0 13 0
case-assist 0 6 0
insight 0 27 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
product-recommendation : missing SSR support
product-listing : missing SSR support
case-assist : missing SSR support
insight : missing SSR support

@olamothe
Copy link
Member

Code delete is the best kind of PR to review

github-merge-queue bot pushed a commit that referenced this pull request Apr 29, 2024
To understand changes this enables, see:
- #3854 where the pagination
sub-controller is put to use
- #3855 where we expose the facet
sub-controllers
- #3857 where we remove now replaced
top-level controllers
- #3859 where we expose the
breadcrumb manager sub-controller

To understand how we came to this solution, see:
- #3825 where we tried slicing the
pagination as a `Record`
- #3800 where we added pagination
and sort as sub-controllers

~And see
feat-capi-719-sliced-pagination-states...feat-capi-719-sliced-structured-pagination-states
for the diff between this approach and the above PR~

[CAPI-719]

[CAPI-719]:
https://coveord.atlassian.net/browse/CAPI-719?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
Base automatically changed from feat-capi-719-facet-sub-controllers to master May 2, 2024 18:07
@Spuffynism
Copy link
Contributor Author

@olamothe @louis-bompart @fbeaudoincoveo Some of the changes affect Atomic, and I'm not sure how to resolve them.

The atomic commerce pager for example uses the top-level pagination builders which are removed in this PR:

this.pager = buildProductListingPagination(this.bindings.engine);
} else if (this.bindings.interfaceElement.type === 'search') {
this.pager = buildSearchPagination(this.bindings.engine);

I'm thinking we should expose the listing/search controller on the commerce bindings directly. Would that be right?

@fbeaudoincoveo
Copy link
Contributor

fbeaudoincoveo commented May 7, 2024

@olamothe @louis-bompart @fbeaudoincoveo Some of the changes affect Atomic, and I'm not sure how to resolve them.

The atomic commerce pager for example uses the top-level pagination builders which are removed in this PR:

this.pager = buildProductListingPagination(this.bindings.engine);
} else if (this.bindings.interfaceElement.type === 'search') {
this.pager = buildSearchPagination(this.bindings.engine);

I'm thinking we should expose the listing/search controller on the commerce bindings directly. Would that be right?

Yes that could work and IMO it would make sense since you'd build the pagination, sort, and facets from those "parent" controllers...

E.g., you'd have:

public initialize() {
  if (this.bindings.interfaceElement.type === 'product-listing') {
    this.pager = this.bindings.productListing.pagination();
  } else if (this.bindings.interfaceElement.type === 'search') {
    this.pager = this.bindings.search.pagination();
  }
}

@olamothe what's your take on this?

@olamothe
Copy link
Member

olamothe commented May 7, 2024

@olamothe @louis-bompart @fbeaudoincoveo Some of the changes affect Atomic, and I'm not sure how to resolve them.
The atomic commerce pager for example uses the top-level pagination builders which are removed in this PR:

this.pager = buildProductListingPagination(this.bindings.engine);
} else if (this.bindings.interfaceElement.type === 'search') {
this.pager = buildSearchPagination(this.bindings.engine);

I'm thinking we should expose the listing/search controller on the commerce bindings directly. Would that be right?

Yes that could work and IMO it would make sense since you'd build the pagination, sort, and facets from those "parent" controllers...

E.g., you'd have:

public initialize() {
  if (this.bindings.interfaceElement.type === 'product-listing') {
    this.pager = this.bindings.productListing.pagination();
  } else if (this.bindings.interfaceElement.type === 'search') {
    this.pager = this.bindings.search.pagination();
  }
}

@olamothe what's your take on this?

Let's do like this: https://github.com/coveo/ui-kit/pull/3895/files#diff-2fa6435e1e9a232914e7a52b08fc3d645170336854aba1f193646e220f23cdafR53-R60

@Spuffynism
Copy link
Contributor Author

@olamothe @fbeaudoincoveo applied that suggestion in d9932b7

@Spuffynism Spuffynism enabled auto-merge May 8, 2024 18:35
@Spuffynism Spuffynism added this pull request to the merge queue May 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 8, 2024
@Spuffynism Spuffynism enabled auto-merge May 8, 2024 19:32
@Spuffynism Spuffynism added this pull request to the merge queue May 8, 2024
Merged via the queue into master with commit 9d7c720 May 8, 2024
91 checks passed
@Spuffynism Spuffynism deleted the feat-capi-719-clean-up branch May 8, 2024 20:27
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.

5 participants