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

Facet empty list when creating a Product #2355

Closed
Swampy469 opened this issue Aug 23, 2023 · 1 comment
Closed

Facet empty list when creating a Product #2355

Swampy469 opened this issue Aug 23, 2023 · 1 comment
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@Swampy469
Copy link
Contributor

Describe the bug
When you're in the process of creating a new product and adding facets to it, you might notice that upon selecting a facet, it doesn't immediately appear in the 'local' chip list. However, rest assured that this is just a temporary display issue. The facets you've selected will become visible in the chip list after the product is either created or edited.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Inventory'
  2. Click on 'New Product'
  3. Press 'Add facets'
  4. Select one facet
  5. Press 'Add facets button’
  6. No facets are showed in the list

Expected behavior
After the selection of the facet I expect to see what I choose before the creation of the product, like the edit view after the creation.

Environment (please complete the following information):

  • @vendure/core version: 20.6
  • Nodejs version: 18.16.1
  • Database (mysql/postgres etc): postgres

Additional context
I am using the Multi Vendor plugin, the user used is a new Seller (no superadmin).

@Swampy469 Swampy469 added the type: bug 🐛 Something isn't working label Aug 23, 2023
@hieundtlu
Copy link

Hi @michaelbromley , This is an urgent issue.

image

I'm not familiar with rxjs, but it seems on Create Screen, entity is empty, and it couldn't listen formFacetValueIdChanges$. I changed ngOnInit as below, and it worked. Please review my solution!

    ngOnInit() {
        this.init();
        const productFacetValues$ = this.entity$.pipe(map(product => product.facetValues));
        const productGroup = this.detailForm;
        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
        const formFacetValueIdChanges$ = productGroup.get('facetValueIds')!.valueChanges.pipe(
            distinctUntilChanged(),
            switchMap(ids =>
                this.dataService.facet
                    .getFacetValues({ filter: { id: { in: ids } } })
                    .mapSingle(({ facetValues }) => facetValues.items),
            ),
            shareReplay(1),
        );
        this.facetValues$ = formFacetValueIdChanges$;
        this.productChannels$ = this.entity$.pipe(map(p => p.channels));
    }

@michaelbromley michaelbromley moved this to 🏗 In progress in Vendure OS Roadmap Oct 18, 2023
@michaelbromley michaelbromley moved this from 🏗 In progress to 🔖 Ready in Vendure OS Roadmap Oct 18, 2023
@michaelbromley michaelbromley moved this from 🔖 Ready to ✅ Done in Vendure OS Roadmap Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
Status: 🚀 Shipped
Development

No branches or pull requests

3 participants