Error when loading more child items from Hierarchy widget

Summary

When attempting to load more items from the child hierarchy widget on &5516 and &9290 (closed), I receive the following error and an endless spinner:

Screenshot_2024-08-12_at_7.42.38_a.m.

Noting that loading more was successful with &10846 (closed)

Root cause

Upon investigation, we found that the epics where this was happening had child items that were also present as related items. This isn't allowed as a feature any more, but chances are that these epics had it from the time when it was allowed. So we need to identify how many such epics exist on GitLab.com where a child epic is also a related epic and figure out a way to ensure loading doesn't fail in those scenarios.

Edited by Kushal Pandya