Commit 83f91d5
committed
relay-transforms: optionally use native gql fragment spreads for unmasked fragments
When Relay encountered a fragment spread with the `@relay(mask: false)`
directive, it would previously inline that fragment text into the query
itself. This is completely valid and equivalent to a native GraphQL
fragment spread. That inlining can dramatically increase the size of
serialize for a query with multiple fragments. Such repetition compresses
extremely well, but clients and servers still pay the cost of having
uncompressed strings in-memory (plus compress/decompress time).
Allow relay users to opt out of fragment inlining for
`@relay(mask: false)` fragment spreads in queries, using a native
GraphQL fragment spread. The reader AST and type generation are not
affected so there's no impact to the relay runtime.1 parent a6f0fb3 commit 83f91d5
File tree
6 files changed
+433
-2
lines changed- compiler/crates
- common/src
- relay-compiler
- tests
- compile_relay_artifacts/fixtures
- relay-transforms/src
6 files changed
+433
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
170 | 178 | | |
171 | 179 | | |
172 | 180 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
832 | 837 | | |
833 | 838 | | |
834 | 839 | | |
| |||
1067 | 1072 | | |
1068 | 1073 | | |
1069 | 1074 | | |
| 1075 | + | |
1070 | 1076 | | |
1071 | 1077 | | |
1072 | 1078 | | |
| |||
0 commit comments