How can I limit relations of a component inside a dynamic zone?

System Information
  • Strapi Version: 4.13.7

I have the following structure to create a dynamic content in the homepage of my website:

  • Homepage (Single Type)
    – Content (Dynamic Zone)
    — Components
    ---- Relation with collection type (A)
    ---- Relation with collection type (B)

Each component has two relational fields with two different collection types.

What I want to achieve?
I want to limit the user in one case (from now FC) to could select 1, either one from type A or one from type B. User cannot select two both.
In the second case (SC) I have the same fields but in this case I want the output of 2 selected relations (could be 1 - 1 / 2 - 0 / 0 - 2).

What is the issue?
When I tried to check in the lifecycle hooks (beforeUpdate) the amount of relations inside the incoming data and I cannot found where the data is. (neither inside the events is the deeply nested data of how many relations has the component)

I tried to let the DB to be updated with the incoming data, saved in state the previous state and in afterUpdate hook do the amount check and if it’s invalid revert the change but it falls in an infinite loop (because I’m updating it again to revert the change).

How can I achieve that? I’m struggling.

Thanks in advance. If you need further information I’m glad to give it.