Lifecycle hook not called on relation update?

Hi,

Object A and B are in a many-to-many relationship.
If object A is updated to remove its relationship to object B, the lifecycle hook on object A is called properly, but not the one on object B (even though it has its relationship changed).

This is problematic for me because of indexing reason with our search engine. The data on object B is then obsolete.

Is there a way to solve this other than manually call the update method on all relations (which can be a long and inconsistent process)?

Thanks!

Interesting. There are two ways of subscribing to lifecycle events documented here: Models | Strapi Documentation Did you try both?

Thanks for your reply. Yes it’s the same issue with the two methods. Is that lifecycle propagation simply not expected to work?

I don’t know, but it smells like a bug or a missing requirement to me. Might be worth creating a github issue or feature request.

@alexandrephiev Talked to derrick about this a while ago this is not a bug but a missing feture what strapi is currently not planning to add since it would have lots of extra cost associated with it.

since lets say someting a content-type has 10k+ relations and now you change 1 relation should now all 10k relations get an event?

Also I would have to query the full content of every relation I run the event for.

How ever you could make this feture yourself if you realy wanted to and add like a relationChanged event to the eventhub

Thanks @Boegie19, that actually makes sense. I will have to add the required ones manually then.