facebook / facebook/relay

[relay-lsp] Position of fields is not updated in the internal program state

Open
#4,447 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

A field's name and location (where it's being used) seems to never be updated internally after the Relay LSP server is started.

## Reproduction

1. Create a Relay Resolver:

```ts
/**
* @RelayResolver Brand.field: String
*/
export function field() {
return null!;
}
```

2. Reference this newly added field in a query or fragment.
3. Restart the Relay LSP
4. Do a "Find All References" on the `field` in the Relay Resolver DocBlock annotation
5. It should correctly find the field where you've used it in a query or fragment
6. Add new fields to the query (so the position of the Relay Resolver field usage changes) or rename the field in the Relay Resolver DocBlock annotation
7. Do another "Find All References"
8. You still get the old position as a result

## Additional information

More context can be found here: https://github.com/facebook/relay/pull/4421#issuecomment-1699728555

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.