You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently I am working on a project where we've adhered to fragment co-location. It seems like this approach has been well adopted and recommended by the community, but now, after refactoring our codebase, we've encountered problems with our query complexity, due to the large payloads we send to our backend.
For example, take the example payload from below
queryusers {
users {
...userInfo
}
}
fragmentuserInfoonUser {
...basicUserInfo...moreUserInfo
}
fragmentbasicUserInfoonUser {
idname
}
fragmentmoreUserInfoonUser {
# ... more fields herediscussions {
...discussions
}
}
fragmentdiscussionsonDiscussions {
messages {
...discussionMessages
}
}
fragmentdiscussionMessagesonMessages {
# ... so on and so forth
}
Querying with our generated code includes all fragments the query requires, and exponentially grows the overall size of our query and the complexity, which leads to slower response times.
This is the codegen config we're using for reference.
I'm wondering if there's a feature or plugin we could use to reduce the overall size of our query by stripping away the fragments in the generation process.
ie. the payload from above would get transformed into this (which at a large scale would exponentially reduce our payload size).
queryusers {
users {
idnamediscussions {
messages {
# ... so on and so forth
}
}
}
}
Describe alternatives you've considered
I'm aware that there are a few options to accomplish something similar with types with configuration options like flattenGeneratedTypes but I cannot seem to find the equivalent for the actual payload.
I've also looked at relay-operation-optimizer which seems to describe what I want to do, but the documentation quite frankly is too vague, and doesn't seem to work at all anymore (I saw in another issue that this was removed in favor of implementing its functionality directly in the codegen module itself).
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently I am working on a project where we've adhered to fragment co-location. It seems like this approach has been well adopted and recommended by the community, but now, after refactoring our codebase, we've encountered problems with our query complexity, due to the large payloads we send to our backend.
For example, take the example payload from below
Querying with our generated code includes all fragments the query requires, and exponentially grows the overall size of our query and the complexity, which leads to slower response times.
This is the codegen config we're using for reference.
Describe the solution you'd like
I'm wondering if there's a feature or plugin we could use to reduce the overall size of our query by stripping away the fragments in the generation process.
ie. the payload from above would get transformed into this (which at a large scale would exponentially reduce our payload size).
Describe alternatives you've considered
I'm aware that there are a few options to accomplish something similar with types with configuration options like
flattenGeneratedTypes
but I cannot seem to find the equivalent for the actual payload.I've also looked at relay-operation-optimizer which seems to describe what I want to do, but the documentation quite frankly is too vague, and doesn't seem to work at all anymore (I saw in another issue that this was removed in favor of implementing its functionality directly in the codegen module itself).
The text was updated successfully, but these errors were encountered: