How to get previous component data in lifecycle hook

v4 does not returns the currently stored relational data inside event object. It only sends the changes in the relational data using connect(array of ids added) and disconnect(array of ids removed). To get the current data you need to query DB.

const { data, where, select, populate } = event.params;
const id = where.id;
const existingData = await strapi.entityService.findOne("api::name.name", id, {
        populate: ["relationalField1", "relationalField2"],
      })
1 Like