I've created a GraphQL Schema in AWS App Sync(1100 lines before autogenerating the resources, queries, mutations and subscriptions, 4800 lines afterwards) to use in react. In my react folder I executed
amplify init
amplify add codegen --apiId myId
then I was asked during execution about the desired nesting depth. My types are very nested so it would be great to have a deeper depth but unfortunately I discovered the enormous increase of file size.
3 levels is 2,5mb
4 levels is 9mb
5 levels is 50mb
from the nesting point I would prefer 5 levels or maybe even more but I want the app to be as performant as possible.
No customer wants to wait until 50mb are loaded
what is your experience about loading large files in graphql? Is it possible to split the large files automatically into smaller ones? At level 5 the files have up to 1m lines of code each.
I use lazy loading in React for my components, it would be great if something similar would be possible here as well.
Do you prefer one large nested query with many levels of depth or several cascaded smaller queries with a low depth?
Regards Christian
Lazy...
... probably you don't need full info about each node (all properties) at once.
You can fetch only id
and name
how deep you need to get structure/relations. Later you can fetch for additional/required (for rendering) properties.