Skip to content

Relational custom field to product variants on collection causes validation errors on save in new dashboard #4196

@robinjoh

Description

@robinjoh

Describe the bug
After the latest update to vendure 3.5.3 i can no longer save my collections because i have a relationship custom field defined to a list of product variants. Getting this error message:
GraphQL Request Error: Variable "$input" got invalid value { includeInNavigationMenu: true, urlKey: "pinnharv", urlPath: "lastmaskin-traktor/jordbearbetning/pinnharv", oldUrlPaths: ["pinnharv"], isPrimaryCollection: true, featuredProductsIds: [], metaTitle: "Pinnharv för traktor", excludeFromRelatedProducts: false, featuredProducts: [] } at "input.customFields"; Field "featuredProducts" is not defined by type "UpdateCollectionCustomFieldsInput". Did you mean "featuredProductsIds"? .

Seems the input is expecting the ids of the featured products that you pick in the list but they dont seem to be passed to the backend. Possible that an empty array must be passed in?

My custom collection field is defined as this:
export const FeaturedProductsField: CustomFieldConfig = { label: [ { languageCode: LanguageCode.en, value: 'Featured products', }, { languageCode: LanguageCode.sv, value: 'Utvalda produkter', }, ], description: [ { languageCode: LanguageCode.en, value: 'Products in this list are considered "featured" and will be prioritized to be displayed when showing products in carousels in the storefront.', }, { languageCode: LanguageCode.sv, value: 'Produkter i den här listan räknas som utvalda produkter och kommer prioriteras när de visas i frontend.', }, ], name: 'featuredProducts', type: 'relation', entity: ProductVariant, list: true, ui: { component: 'product-selector-form-input', }, };

So currently this is completely blocking us from saving any collections in the dashboard and if it is not fixed as soon as possible we must downgrade. :/

To Reproduce
Steps to reproduce the behavior:

define a product variant relationship on collection as i have pasted above. Then create a collection and try to update it. You will receive a validation error.

Expected behavior
Collection to be properly saved.

Actual behavior
Validation error.

Screenshots/Videos
Image

Error logs
If applicable, paste any relevant error messages or stack traces:

Paste error logs here

Environment (please complete the following information):

  • @vendure/core version: 3.5.3
  • Nodejs version: 24
  • Database (mysql/postgres etc): PG
  • Operating System (Windows/macOS/Linux): Linux
  • Browser (if applicable): chrome
  • Package manager (npm/yarn/pnpm): yarn

Configuration
If relevant, share your Vendure configuration (remove sensitive data):

Minimal reproduction
If possible, provide a minimal code example or repository that reproduces the issue.

Workaround
If you found a temporary workaround, please describe it here.

Additional context
Add any other context about the problem here, such as:

  • When did this issue start occurring? After upgrading to vendure 3.5.3, latest release.
  • Does it happen consistently or intermittently? Consistently.
  • Any recent changes to your setup? No.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions