Open ikenox opened 3 months ago
Hi @ikenox -- I'm looking into this now!
sounds similar to https://github.com/payloadcms/payload/issues/6800 which was fixed in 2.22.1. can you reproduce with a newer version of payload?
edit: whoops didn't read carefully, might be a similar but separate issue 😅
@wkentdag Yes, I rebased my reproducible code on v2.24.1 but the problem still remains. https://github.com/ikenox/payload/commit/96172618e619ed3d116912a89c20da871441a1e2
Yep, we've addressed some other issues wherein arrays have null
values in them. We're diggin' into it! :)
Link to reproduction
https://github.com/ikenox/payload/commit/bd0674af229da5c717a5c469ade7001a2e7d9a9b
Describe the Bug
Posts
collection andTags
collection (Posts has 0-to-many tags)tags
data is filtered by access control.Query:
Result:
Detail of the bug
https://github.com/payloadcms/payload/blob/4c832ad/packages/payload/src/graphql/schema/buildObjectType.ts#L371-L397
At here,
result
will benull
when the data is filtered by read-access control.result
isnull
, a processresults[i] = ...
is skipped.So, for example, when
result
isnull
ati=0
, theresults
array will be[null, data1, ...]
. Thisresults
array is invalid because it containsnull
even though the graphql schema type oftags
is an array of non-null tag type ([Tag!]
) .To Reproduce
I added a minimum reproducible test.
pnpm test:int:postgres _community
will fail. https://github.com/ikenox/payload/commit/bd0674af229da5c717a5c469ade7001a2e7d9a9bPayload Version
2.18.3
Adapters and Plugins
db-postgres: 0.8.4