Smart Action hooks change broken between v7 and v8

Expected behavior

Smart Action change hooks to work

Actual behavior

After migrating to v8, change hook is returning an error. I’ve tried reusing the exact same code from documentation in case it has changed, but still having the same error with following code:

hooks: {
        change: {
          onCityChange: async ({ fields, request, changedField }) => {
            return fields;
          },
        },
      },

Failure Logs


Context

Please provide any relevant information about your setup.

  • Package Version: forest-express-sequelize@8.2.7
  • Express Version: 4.17.1
  • Sequelize Version: 5.15.2
  • Database Dialect: PG
  • Database Version: 11
  • Project Name: Shotgun Admin

Hey @Lucas_Gerard,

Could you share here the complete definition of your smart action?

Here is a quick example if that may help

{
    name: 'SmartActionExample',
    type: 'bulk',
    fields: [{
      field: 'supplier',
      type: 'String',
      hook: 'onSupplierChange', // Changes on supplier should trigger onSupplierChange
    }],
    hooks: {
      change: {
        onSupplierChange: async ({ fields }) => {
          console.log("onSupplierChange called");
          return fields;
        }
      }
    }
  }
1 Like

Hello @jeffladiray, thanks for your reply, indeed I’ve missed the following line!

1 Like