Feature(s) impacted
Hooks in a smart action.
Observed behavior
{
name: 'Example',
endpoint: '/forest/actions/example',
type: 'single',
fields: [
{
field: 'ok',
type: 'Boolean',
isRequired: true,
defaultValue: true,
hook: 'onOkChange',
},
{
field: 'displayName',
type: 'String',
},
],
hooks: {
load: async function ({ fields }) {
console.log('LOAD START');
await sleep(1000);
console.log('LOAD DONE');
return fields;
},
change: {
onOkChange: async function ({ fields }) {
console.log('OK START');
await sleep(1000);
console.log('OK DONE');
return fields;
},
},
},
},
When I open the smart action form, both load and change hooks are fired concurrently. Depending on the order they complete, one overwrites the other.
Expected behavior
- No change hook should be fired when opening the form.
- If both really need to be fired, I would expect the change hook to wait for the load hook to complete before starting.
Context
- Project name: Evy
- Team name: Operations
- Environment name: Dev
- Agent technology: nodejs
- Agent (forest package) name & version: forest-express-sequelize 9.5.4
- Database type: PostgreSQL