System Information
- Strapi Version: 4.1.12
- Operating System: Debian
- Database: PostgresSQL
- Node Version: 14.18.3
- NPM Version: 6.14.15
- Yarn Version: -
Hello here! I’m trying to automatically calculate macronutrients for a recipe but i’m kinda stuck here:
- The ingredients are dynamic components
- They have the data i need to calculate the total macronutrients for the recipe
- I’d like to calculate them on every creation and every update of a Recipe instance, Recipe having the total fields for the macronutrients on first-level
- I used beforeUpdate lifecycle but i can’t get the datas in event.params.data (image)
- I wanted to try afterUpdate lifecycle but it would trigger infinite loop on lifecycle because i would need to update the instance again
Is there any workaround? Or what am i doing wrong? Thanks in advance