feat(typescript-operations): Add option 'combineFragmentNames' to combine only certain fragments when inlineFragmentTypes is 'inline' #10062
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.
Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.
Description
The default 'inline' behavior for
inlineFragmentTypes
causes our project generated file to reach 12MAfter some testing, 'combine' wasn't the right option for us either.
We really preferred 'inline' however we had 1 or 2 HUGE fragments used everywhere.
By not inlining those few fragments we could bring down the resulting generated file to ~3.5M
We've been working with a patch of the package for years now and I thought it be time to contribute back upstream in case others hit a similar issue.
Type of change
How Has This Been Tested?
Been running this in production for years now.
Wrote a unit test to show the usage.
Checklist:
Further comments
I initially wanted to extend the type of
inlineFragmentTypes
to either'inline' | 'combine' | 'mask' | string[]
or'inline' | 'combine' | 'mask' | { type: 'inline', except?: string[] }
These types are confusing and "hard-ish" to describe in json schema.
So I decided to make a new option instead with a runtime validation since I believe this option is broken when
inlineFragmentTypes = 'mask'