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

refactor: don't repeat InternalIDField definition #6254

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

Conversation

nickskalkin
Copy link
Contributor

Follow-up of this code review comment: #6249 (comment)

Before I was repeating definition of InternalID field in multiple places, now I simply spread the definition from a single place.

Copy link
Member

@dblandin dblandin left a comment

Choose a reason for hiding this comment

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

Nice 👍🏼

@@ -245,6 +245,14 @@ export const InternalIDFields: GraphQLFieldConfigMap<any, ResolverContext> = {
},
}

export const InternalIDField: GraphQLFieldConfigMap<any, ResolverContext> = {
Copy link
Member

Choose a reason for hiding this comment

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

suggestion / non-blocking: Can we also reuse this definition within the GraphQLFieldConfigMaps defined above?

For example:

export const InternalIDFields: GraphQLFieldConfigMap<any, ResolverContext> = {
  id: GlobalIDField,
  internalID: InternalIDField
}

type: new GraphQLNonNull(GraphQLID),
resolve: ({ id }) => id,
},
...InternalIDField,
Copy link
Member

Choose a reason for hiding this comment

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

suggestion / non-blocking: Since this is just a single field and we're not spreading multiple fields, pulling in the specific field definition might be fine too:

internalID: InternalIDField

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