Merge pull request #9395 from tchak/graphql-improuve-stored-query

graphql(attachment): prevent null errors
This commit is contained in:
Paul Chavard 2023-08-08 14:22:44 +00:00 committed by GitHub
commit 202e310d03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -242,6 +242,7 @@ class API::V2::StoredQuery
}
fragment DossierFragment on Dossier {
__typename
id
number
archived
@ -463,6 +464,7 @@ class API::V2::StoredQuery
__typename
label
stringValue
updatedAt
... on DateChamp {
date
}
@ -592,11 +594,13 @@ class API::V2::StoredQuery
fragment FileFragment on File {
__typename
filename
contentType
checksum
byteSize: byteSizeBigInt
url
createdAt
}
fragment AddressFragment on Address {
@ -643,6 +647,7 @@ class API::V2::StoredQuery
fragment PageInfoFragment on PageInfo {
hasPreviousPage
hasNextPage
startCursor
endCursor
}
GRAPHQL

View file

@ -35,7 +35,7 @@ module Extensions
# is a lazy value (e.g., a Promise like in our case)
def after_resolve(value:, **_rest)
if value.respond_to?(:map)
attachments = value.map { after_resolve_attachment(_1) }
attachments = value.map { after_resolve_attachment(_1) }.compact
if options[:as] == :single
attachments.first