vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.61k stars 993 forks source link

Sorting products is not working when use product custom field #3006

Open Dominic-Preap opened 1 month ago

Dominic-Preap commented 1 month ago

Describe the bug

We add a new custom field call suggrestProducts and use the default UI from Vendure when choose type: "relation" and entity: Product. The UI render is correct but when we try to update the suggest product list by drag some product up and save, but it seems the suggest products does not update as expected. You can check demo video below.

https://github.com/user-attachments/assets/dd5e56f5-3a18-495d-b43c-29af36b042da

To Reproduce

  1. Add suggestProducts in custom fields product on Vendure config.
    
    import { LanguageCode, Product, VendureConfig } from "@vendure/core";

export const config: VendureConfig = { customFields: { Product: [ { name: "suggestProducts", list: true, type: "relation", entity: Product, label: [{ languageCode: LanguageCode.en, value: "" }], ui: { tab: "Suggest Products" }, }, ], }, };


2. Restart dev server 
4. Go to product detail page and scroll down
5. Select a few prodcuts on custom field and save
6. Then reload the page and try to drag product up and save again
7. Reload the page again, the suggest product is still the same.

**Expected behavior**

Draggable on suggest products should be update after saving the product.

**Environment (please complete the following information):**
 - @vendure/core version: 3.0.0
 - Nodejs version: 20
 - Database: mysql

**Additional context**
N/A
jakubnavratil commented 4 days ago

I can confirm this behavior. Sort order of custom field relation is not saved or is not loaded.