'Hotchocolate C#, down and up same hierarchy does not give correct keys to the GroupDataLoaders

I have three tables in my database that are connected as a many to many relation. They are called Asset, MeterPoint and AssetMeterPointMember.

When performing this query I get an unexpected result:

query
{
    meterPoints
    {
        id,
        eic,
        assetMeterPointMembers (79 keys)
        {
            asset (80 keys)
            {
                id,
                assetMeterPointMembers (13 keys)
                {
                    meterPoint (46 keys)
                    {
                        id,
                        eic
                    }
                }
            }
        }
    }
}

Overview of query results

The image shows relations when fetching from the database and fetching with GraphQl.

Database

There are 79 MeterPoints.

53 of those have Assets connected through AssetMeterPointMember.

There are 88 Assets and 80 of those are connected to a MeterPoint.

GraphQl

Keys = primary keys for the database.

-> = Are sent to GroupDataLoader.

79 keys -> AssetMeterPointMember GroupDataLoader in MeterPoint (Correct)

80 keys -> Asset GroupDataLoader in AssetMeterPointMember (correct)

13 keys -> AssetMeterPointMember GroupDataLoader in Asset (Incorrect)

The 13 keys are always fetched from the newest data, but there are some keys left out, so no logic there.

46 keys -> MeterPoint GroupDataLoader from AssetMeterPointMember (Incorrect)

Expected

I would expect to have at least the same amount of keys going up again in the hierarchy.

Can someone please explain what might cause this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source