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(graphqlsp): Bail out of unrollFragment infinite loop #347

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kitten
Copy link
Member

@kitten kitten commented Jul 30, 2024

NOTE: This is opened as a draft, since it's not a proper fix, but just demonstrates the issue.

Optimally, a proper fix should either:

  • handle this in every call to getDefinitionAtPosition diagnostics,
  • or; replace getDefinitionAtPosition in places where an alternate solution is more reliable

In specific places we should have diagnostics for these cases, since they're usually user errors (or critical errors we can't recover from).

For example, in the changed section in unrollFragment, we should tell the user that the fragment import is unresolveable.
There's also sections for whether a fragment is actually a GraphQL fragment call. If not, we should maybe consider adding a diagnostic to that before bailing out too.

Copy link

changeset-bot bot commented Jul 30, 2024

⚠️ No Changeset found

Latest commit: 7d51c87

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

if (found === element) {
// TODO: Instead of bailing out here, we should be able to issue a diagnostic here
// that tells the user that resolution of a fragment has failed.
return fragments;
Copy link
Member

@JoviDeCroock JoviDeCroock Aug 2, 2024

Choose a reason for hiding this comment

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

Let's add a throws argument or something so we can throw if need be from the CLI

Copy link
Member Author

Choose a reason for hiding this comment

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

re. notes in PR description, I don't think this is really safe to merge, but instead more for "notes" so I can come back to it 😄
There's several cases where I think similar issues can happen, and there's not really a great option to addressing most of them right now, until we can escalate granular errors, otherwise we basically end up either hiding the issue from the user and it'll only become apparent when they check output (or not at all) or we'd be taking debug info away from ourselves 🤔

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.

2 participants