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

[relay-lsp] Add a refactor to turn global variable into explicit fragment argument #4600

Open
tobias-tengler opened this issue Jan 25, 2024 · 1 comment

Comments

@tobias-tengler
Copy link
Contributor

No description provided.

@captbaritone
Copy link
Contributor

Might be more correct to say "turn a global variable reference into an explicit fragment argument".

I'm imagining it would turn this:

fragment UserProfile_fragment on User  {
  name
  profile_picture {
    url(scale: $scale) # <-- Right click here to refactor...
  }
}

query($scale: Float!) {
  me {
    ...UserProfile_fragment
  }
}

Into:

fragment UserProfile_fragment on User @argumentDefinitions(
  scale: {type: "Float"} # <--  Maybe you could even have the ability to specify this as a new local name?
) {
  name
  profile_picture {
    url(scale: $scale)
  }
}

query($scale: Float!) {
  me {
    ...UserProfile_fragment @arguments(scale: $scale)
  }
}

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