New UI: refresh hasMany relationship no longer works

I have a model with a hasMany relationship

  IntegrationBudgets.associate = (models) => {
    ...
    IntegrationBudgets.hasMany(models.integrationBudgetEntries, {
      foreignKey: {
        name: 'integrationBudgetIdKey',
        field: 'integration_budget_id',
      },
      as: 'integrationBudgetIntegrationBudgetEntries',
    });
  };

In a smart action, I add “IntegrationBudgetEntries” to my “IntegrationBudget” :

router.post('/actions/ajouter-ligne-budget', permissionMiddlewareCreator.smartAction(), (request, response) => {
  const data = request.body.data.attributes.values;
  const integration_budget_id = request.body.data.attributes.ids[0];
  const repartition_key_id = data['Clé de répartition'].split(' - ')[0];

  const body = {
    integration_budget_entry: {
      integration_budget_id,
      display_name: data['Libellé'],
      repartition_key_id,
      amount: Math.trunc(data['Montant TTC'] * 100)
    }
  };

  axios.post(`${API_URL}/forest_admin/integration_budget_entries`, body, {
    headers: {
      'Authorization': `Bearer ${process.env.ACCESS_TOKEN}`,
      'X-CURRENT-USER-EMAIL': request.user.email
    },
  }).then(() => {
    response.send({
      refresh: {
        relationships: ['integrationBudgetIntegrationBudgetEntries']
      }
    });
  }).catch(err => {
    response.status(400).send({ error: err.response.data.error.message });
  });
});

But the

 response.send({
      refresh: {
        relationships: ['integrationBudgetIntegrationBudgetEntries']
      }
    });

doesn’t refresh the hasMany relationship anymore, I have to manually refresh:

Context

  • Project name: Sergic
  • Team name: Gestion
  • Environment name: Dev
  • Agent type & version:
    “forest-express”: “^7.9.4”,
    “forest-express-sequelize”: “^7.12.3”,
  • Recent changes made on your end if any: None

Hey @JeremyV,

I’ll try to reproduce on my side

Just a quick update: I could reproduce this issue on other hasMany relationships, with related data displayed in the summary view

It seems (to me) to be a general issue

Hello @JeremyV,

I finally reproduced your issue! :raised_hands:
It’s not working only when having a smart action form.

I am creating a bug report and we’ll fix asap.
We’ll let you know once it’s done.

Thanks a lot for bringing that up!

1 Like

@JeremyV,

The fix has been deployed.
Can you confirm it’s all working fine on your side now?

Thanks again.

1 Like

I confirm it’s working smoothly ! Cheers @anon34731316

1 Like