Open knaeckeKami opened 8 months ago
Hey again @knaeckeKami :D I've tested it and for now, I am getting Out of memory error. I guess its because scope is much smaller than the previous solution and that's why.
And btw I had to manually modify fery_generator bcs the current version 0.8.2. expects dataClassConfig
This is just an idea for an alternative implementation to #417
This is a different approach to reusing fragments and reduce duplication in the code.
The idea is: Keep a Map of
(TypeName ,BuiltSet<SelectionNode>) -> Reference
for already generated fragments.This will use the actual selections for figuring out whether a new class needs to be created or a fragment can be reused.
TODO: try if reusing generated subclasses for inline fragment spreads can also be optimized, without potential conflicts in types
TODO: potentially this can be extended to not only reuse fragments but all generated classes, if they have the same selections.
Drawbacks: the names of the generated classes are less stable and could change by adding new fragments which can be used
Advantage: IMO simpler to understand, easier to extend