graphql-code-generator-community icon indicating copy to clipboard operation
graphql-code-generator-community copied to clipboard

Allow toggling useSuspenseQuery generation

Open melchua opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

useSuspenseQuery support was added in 4.1.0, this is great. But useSuspenseQuery requires Apollo 3.8 and our app is still in the process of upgrading to it. This however has added useSuspenseQuery to all our generated files and gives a ton of warnings because it's running an Apollo hook that doesn't yet exist.

Describe the solution you'd like

Could we add config to allow toggling the useSuspenseQuery generation? As far as I can tell there isn't a way yet, but please let me know if there is.

Describe alternatives you've considered

Currently we've had to downgrade to the version prior to the minor update.

Additional context

Thank you!

melchua avatar Feb 07 '24 18:02 melchua

Not to mention this will probably go into the bundle of everyone even if not used... would be amazing to be able to toggle those functions off

Grohden avatar Feb 14 '24 18:02 Grohden

I agree. The configuration only recognizes apolloClientVersion 2 or 3. Generating code that is supported only by a feature introduced in Apollo client 3.8 is a breaking change. I also think the default value for useSuspenseQuery should be false

yoavain-sundaysky avatar Apr 30 '24 13:04 yoavain-sundaysky