facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.27k stars 1.8k forks source link

Start uniquely naming node default exports in generated code #4644

Open jakst opened 3 months ago

jakst commented 3 months ago

Currently the default exports of queryname.graphql.ts and queryname$parameters.ts are simply named node. This makes it really cumbersome to work with import suggestions, as typing node will suggest every query in the whole project (see screenshot from VS Code).

image

Instead I suggest these exports get a unique name, so that the name of the query can be typed to get a single import suggestion from the IDE. Additionally the export could be exported as a named query in addition to the default export (to avoid breaking existing code).

Examples of names for the queries could be queryNameNode for queryName.graphql.ts and queryNamePreloadable for queryName$parameters.ts.