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

fix: only optimistically resolve nested entities #298

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

Sekhmet
Copy link
Contributor

@Sekhmet Sekhmet commented Jun 12, 2024

Closes: #296

Depends on: #297

Test plan

Test on this branch https://github.com/checkpoint-labs/checkpoint-template/compare/sekhmet/tt?expand=1

Run this query:

{
  user(id: "a") {
    id
  }
  users {
    info {
      id
    }
  }
}

First entity doesn't resolve, without this PR it would.

@Sekhmet Sekhmet requested a review from bonustrack June 12, 2024 13:02
Base automatically changed from sekhmet/ranges to master June 12, 2024 14:16
We have this optimization that nested entities will resolve id if it's
only requested field without making actual database query.

This might not be ideal, if relation is broken (for example Space references
not existing SpaceMetadata), but can save some queries, so it's mostly
just a convention.

However this ended up also short-circuting requests like this:
```gql
query {
  space(id: "eth:doesnotexist") {
    id
  }
}
```

This commit prevents this from happening, by checking if it was resolved
from parent.
@Sekhmet Sekhmet force-pushed the sekhmet/fix-nested-lookup branch from 8d4f74c to 7324d25 Compare June 12, 2024 14:17
Copy link
Contributor

@bonustrack bonustrack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@Sekhmet Sekhmet merged commit 8fd68a1 into master Jun 12, 2024
1 check passed
@Sekhmet Sekhmet deleted the sekhmet/fix-nested-lookup branch June 12, 2024 15:17
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

Successfully merging this pull request may close these issues.

bug: validate entity actually exists when looking up only id
2 participants