Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

productReviews will throw an error if you fetch any review for a deleted product #525

Closed
macrozone opened this issue Dec 2, 2022 · 2 comments

Comments

@macrozone
Copy link
Contributor

Describe the bug

see this comment #379 (comment)

unchained wrongly sets ProductReview.product to be non-nullable but will return null if the product is deleted (no matter if it got deleted from the db or just marked as deletd.

ProductReview.product should be nullable.

To Reproduce

  1. create a review for a product
  2. delete that product
  3. fetch productReviews via graphql

Expected behavior

ProductReview.product should be nullable.

@macrozone
Copy link
Contributor Author

by the way, modern grapqhl libraries can prevent misstakes like that. e.g. https://pothos-graphql.dev/ has a really strong type support. If you use strict mode it would complain that your productService (or collection) can return null and would not allow that this result will be used in a non-nullable resolver

@pozylon
Copy link
Member

pozylon commented Dec 6, 2022

the problem was that the product field did not return deleted products, this is wrong, reviews of deleted products should still return the deleted product. fixed in newest beta.

@pozylon pozylon closed this as completed Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants