How to correctly handle orphaned data in a __resolveReference #7523
Unanswered
jaspertandy
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a federated schema where you can message someone about an item on a site. On a long enough timeline, it may be that one of the items becomes unavailable and, thus, would return
null
in__resolveReference
. However, the messages service would still hold a reference to it.In my messages resolver:
In my Item resolver:
All things being well, this runs fine. However, if my
item
resolver in messages returns{ id: 'item that has now been deleted' }
and__resolveReference
now returnsnull
, this causes an error if I was trying to query any mandatory fields on the returned Item (i.e. title is required).I would expect that returning
null
from __resolveReference would override the{ id: 'item that has now been deleted' }
but it seems to be merging with that and then causing me problems!So would you expect in this instance, rather than my
__resolveReference
returningnull
, should it return a representation that is like{ id: 'item that has now been deleted', title: 'No longer available' }
or is there something I can do essentially where myitem
resolver and__resolveReference
are merged, in order to say "if__resolveReference
is null, return null for everything"?Sorry if this is something that's been asked before - I've searched around a lot but I feel like I'm not using the correct terms because I feel like it's a fairly common usecase! Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions