Closed Sekhmet closed 12 months ago
It works now with Int
as id for sub-entity but somehow now String
as id for sub-entity doesn't work anymore, where filters are not created for the sub-entity, see my query:
query {
users (where: { profile_: { id: "0x4C7909d6F029b3a5798143C843F4f8e5341a3473" }}) {
id
profile {
id
discord
}
}
}
Also query would fail if there is an entry without sub-entity (this might be the normal behavior):
query {
topics {
id
category {
metadata_uri
}
}
}
query {
topics {
id
category {
id
}
}
}
This is using same schema here: https://github.com/snapshot-labs/highlight/blob/main/src/api/schema.gql
@bonustrack can you test this? I believe it will use different type name for nested queries than TheGraph, but it will work for sx-api purposes - I think they support multi-level nested queries which we don't, so we have to use unique names for where type with subentities, and without subentities (for example Topic_filter has subentities, but Topic_User_filter won't).
This did the fix for the first query. For the 2nd query I got this error:
"The loader.load() function must be called with a value, but got: undefined.
And the 3rd I got
Cannot return null for non-nullable field Category.id.
What do you expect to happen in this case if database state is inconsistent (which I assume if the case here) - you reference object that doesn't exist in the database? I guess for nullable subentity (like in this case) it should return null for entire entity, for non-nullable it should throw something (hopefully more meaningful).
~Can you do DB dump so I can reproduce this?~ will create my own repro on sx-api.
@bonustrack tackled the issue with missing entities in different PR as those are unrelated: https://github.com/checkpoint-labs/checkpoint/pull/269
If you set category
to null it will return null. If you set category
but subentity is missing it will return null, but will also add error about missing entity.
I couldn't find a way to reproduce loader error. Do you know when it happens?
Closes: https://github.com/checkpoint-labs/checkpoint/issues/267