我想这是因为它相对较新,但是弄清楚什么是错误以及什么实际上是Apollo中的错误真是太痛苦了。
我创建了一个名为“ EventFragment”的片段,我想将其扩展为另外两个片段。
只要它只有一个,它就可以很好地工作,但是一旦超过一个,我就会收到错误消息“只能有一个名为EventFragment的片段”,显然没有。
这是一个错误,还是我只能在另一个环境中使用一个片段?
import gql from 'graphql-tag'
export const EventFragment = gql`
fragment EventFragment on Event {
id
createdAt
updatedAt
deletedAt
title
description
type
date
isSystem
addedBy {
id
firstName
lastName
}
liability {
id
loan {
id
name
}
}
isRepeating
repeatNumber
repeatUnit
files {
id
createdAt
updatedAt
deletedAt
filename
}
company {
id
}
person {
id
}
}
`
export const LiabilityFragment = gql`
fragment LiabilityFragment on Liability {
id
createdAt
updatedAt
deletedAt
name
isFixed
loanTerm
interestOnlyTerm
startDate
financePurpose
limit
amount
initialBalance
repaymentAmount
repaymentFrequency
discountPercent
bankAccountName
bankAccountBsb
bankAccountNumber
assets {
id
deletedAt
name
address {
id
address
}
}
people {
id
percent
person {
id
firstName
lastName
deletedAt
}
}
companies {
id
percent
company {
id
name
deletedAt
}
}
loan {
id
name
}
events {
...EventFragment
}
}
${EventFragment}
`
export const PersonFragment = gql`
fragment PersonFragment on Person {
id
createdAt
updatedAt
title
firstName
middleName
lastName
preferredName
previousName
address {
id
offPlan
level
building
unitNumber
address
}
dateOfBirth
gender
maritalStatus
email
phonePreference
phoneHome
phoneWork
phoneMobile
phoneFax
actingOnTrust
trustName
dependants {
id
name
age
}
liabilities {
id
percent
deletedAt
personRelation {
...LiabilityFragment
}
companyRelation {
...LiabilityFragment
}
}
assets {
id
percent
deletedAt
personRelation {
...AssetFragment
}
companyRelation {
...AssetFragment
}
}
events {
...EventFragment
}
}
${LiabilityFragment}
${AssetFragment}
${EventFragment}
`