Error with hooks : cannot set property of undefined

Feature(s) impacted

A smart action is not loading properly

Observed behavior

When opening a smart action, we have an error in our backend for a hook. The action is a copy from another project with an old version, maybe we have to update our hook ?

Expected behavior

No error and our smart action is accessible for the user

Failure Logs

[forest]Error in smart load action hook: Cannot set properties of undefined (setting ‘enums’)

Context

  • Project name: biben
  • Team name: operations
  • Environment name: develoment
  • Database type: postgresql

here is the code, the error is on the line : fields[‘Identité’].enums = …

Hello @mduhez

Here is the migration guide: Upgrade to v8 - Developer guide

The change in your case should be

// before
const identity = fields['identité'];

// after
const identity = fields.find(f => f.field === 'identité')

Note that change hooks have also changed if you are using those.

1 Like

thank you for this reply