Search code examples
strapi

Are Strapi lifecycle callbacks 'broken'?


I'm interested in using Strapi's lifecycle callbacks -- https://strapi.io/documentation/3.0.0-beta.x/concepts/models.html#lifecycle-callbacks -- and someone in a Strapi forum mentioned that they are broken at the moment. I tried to add one to my model's create method and it seems to work. What is the current state? We are considering Strapi for a large project, but it's in beta, and I'm not sure if it's at a stable enough state for us to use it.


Solution

  • Yes as of right now the lifecycle callbacks are considered broken, you can follow the tracking issue here: https://github.com/strapi/strapi/issues/1443

    They do plan to be reviewed before Strapi goes stable in the next 2 months I believe.

    Edit: If you want to perform any of the beforeX logic you can override the controllers. The afterX is where things become a bit more difficult...