Merge pull request #9395 from tchak/graphql-improuve-stored-query
graphql(attachment): prevent null errors
This commit is contained in:
commit
202e310d03
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue