keystonejs / keystone

The superpowered headless CMS for Node.js — built with GraphQL and React
https://keystonejs.com
MIT License
9.18k stars 1.15k forks source link

[AdminUI] VirtualField: Cannot access 'value' before initialization #2470

Closed cozawariat closed 4 years ago

cozawariat commented 4 years ago

Bug report

Describe the bug

cant get Virtual field to work :confused: Uncaught ReferenceError: Cannot access 'value' before initialization The above error occurred in the <VirtualField> component

my setup is simple:

fields: {
      firstName: {
        type: Text,
        isRequired: true
      },
      lastName: {
        type: Text,
        isRequired: true
      },
      fullName: {
        type: Virtual,
        resolver: item => (`${item.firstName} ${item.lastName}`)
      }
}

To Reproduce

The error occurs when i am trying to edit existing record in Admin UI

Expected behaviour

Edit form should be opened

System information

Vultraz commented 4 years ago

Are you using the latest @keystonejs/fields package? This sounds like what was fixed in bd4096ee86f7790c76db23090b38f880e5aa7ecc.