In our platform we have a favourites collection that's a many to many relationship between content items and users, however there are scenarios whereby users could favourite a content post and then subsequently not have access to that content item, meaning we get the following error when querying via gql
Cannot return null for non-nullable field Favourite.content
I am wondering whether there is a good way of handing this? Ideally without modifying the favourites table, as they could regain access to that content in the future
Anyone have any ideas on this?
Not been able to figure this one out yet, anyone got any ideas?
hi @devperson - can you update
favourite.content
to be a nullable field? can you show where you are defining the schema?
Also, this page is helpful:
https://graphql.wtf/episodes/42-graphql-nullabilityIt was a graphql schema generated by payload, is there a way to mark a field as nullable?
Sorry for the delay - do you still need help here @devperson?
not urgently, we worked around this by making a custom graphql endpoint rather than the default payload generated endpoint to handle this
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.