I have 3 collections (A, B, C) where I want my admin users to be able to create collection C from collection B's create/edit page, and I want users to also be able to create collection B and in-turn C (given C is in B) inside collection A's create/edit page.
My approach to this is to create an array field inside the parent collections that hold the exact same fields as the child collection, so for example if we look at collection A, it'll have an array field with the exact same fields as collection B, and this array field of collection B (inside A) will also have an array field of collection C fields.
When a user create/edits these fields in A, I have an afterChange hook that reconciles them with their actual collections.
For collection B which is a parent collection of C, my reconciliation hook works, I can create collection C items through B.
However for collection A which is a parent to B and a grandparent to C, it doesn't work as expected. When I try to create collection B through A, without any collection C items, both collection B and A items are created successfully, but whenever I add a collection C item under collection B through the collection A editing interface, I get a Not Found error. This error only appears when I try to create collection C through A.
For some reason the payload.logger doesn't log inside the hook either, even when it's top level.
My question is firstly, is there a better approach to achieve the user experience and functionality I've described?
If my approach is acceptable, how do I navigate the error so that users can create collection C items through A.