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

Custom relation entity missed translation feature on V2.1 #2453

Closed
tianyingchun opened this issue Oct 16, 2023 · 1 comment
Closed

Custom relation entity missed translation feature on V2.1 #2453

tianyingchun opened this issue Oct 16, 2023 · 1 comment
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@tianyingchun
Copy link
Contributor

tianyingchun commented Oct 16, 2023

Describe the bug

Please consider below sense

  1. we have custom fields on Collection entity named campaign with type: relation, eager:true
/**
 * `Collection` basic custom fields for `campaign`
 */
export const collectionCustomFields: CustomFieldConfig[] = [
  {
    type: 'relation',
    name: 'campaign',
    nullable: true,
    entity: Campaign,
    eager: true,
    public: true,
    label: [
      {
        languageCode: LanguageCode.en,
        value: 'Campaign',
      },
    ],
    description: [
      {
        languageCode: LanguageCode.en,
        value: 'Campaign of this collection page',
      },
    ],
  },
];
  1. for campaign.entity we have translation feature defined campaign.translaton.entity
  2. we defined a gql schema for compaign as below
  type Campaign implements Node {
    id: ID!
    createdAt: DateTime!
    updatedAt: DateTime!
    name: String
    code: String!
   "this field will be include on `CampaignTranslation`"
    languageCode: LanguageCode!
    translations: [CampaignTranslation!]!
  }
  1. cause of languageCode only defined on CampaignTranslation.entity
  2. go to admin-ui, nagivate to catalog/collections, click to children catalog item
image

query GetCollectionList($options: CollectionListOptions)

it will throw error:

"message": "Cannot return null for non-nullable field Campaign.languageCode."
becuase

...
 customFields {
        collectionType
        isFeatured
        invisible
        metaTitle
        metaDescription
        collectionKeys
        campaign {
           id 
          // this field need to be `translation`
          languageCode
          ...
       } 
}

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • @vendure/core version: 2.1
  • Nodejs version: 18
  • Database (mysql/postgres etc):mysql

Additional context
Add any other context about the problem here.

@tianyingchun tianyingchun added the type: bug 🐛 Something isn't working label Oct 16, 2023
@tianyingchun
Copy link
Contributor Author

tianyingchun commented Oct 16, 2023

the mini repo is :https://github.com/tianyingchun/vendure-issue.git

  1. checkout branch vendure_issure_2453
  2. yarn install
  3. goto plugin-issue
  4. npm run build
  5. goto dev-server
  6. yarn serve
  7. http://localhost:3001/admin/catalog/collections
    it will throw error.

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
None yet
Development

No branches or pull requests

2 participants