-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: out-of-memory crash (#7720) and significantly improve performanc…
…e + feat: extracting fields to types (#9705) * fix: out-of-memory crash and significantly improve performance Co-authored-by: Cynthia Ma <cma@zendesk.com> Co-authored-by: Bazyli Brzoska <bbrzoska@zendesk.com> fixes #7720 * test: add bug reproduction from #7720 fixes #7720 --------- Co-authored-by: Bazyli Brzóska <bazyli.brzoska@gmail.com>
- Loading branch information
Showing
13 changed files
with
24,334 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
'@graphql-codegen/visitor-plugin-common': minor | ||
'@graphql-codegen/typescript-operations': minor | ||
--- | ||
|
||
fix: out-of-memory crash (fixes #7720) | ||
perf: implement a caching mechanism that makes sure the type originating at the same location is never generated twice, as long as the combination of selected fields and possible types matches | ||
feat: implement `extractAllFieldsToTypes: boolean` | ||
feat: implement `printFieldsOnNewLines: boolean` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
import gql from 'graphql-tag'; | ||
|
||
export const WPColumns = gql` | ||
fragment WPColumns on WpCoreColumnsBlock { | ||
__typename | ||
attributes { | ||
... on WpCoreColumnsBlockAttributes { | ||
align | ||
verticalAlignment | ||
} | ||
} | ||
innerBlocks { | ||
...WpColumnFields | ||
...WpCoreImageBlockFragment | ||
...WpCoreGalleryBlockFragment | ||
innerBlocks { | ||
__typename | ||
...WpCoreImageBlockForGalleryFragment | ||
...WpCoreGalleryBlockFragment | ||
saveContent | ||
dynamicContent | ||
isDynamic | ||
# | ||
... on WpCoreGalleryBlock { | ||
__typename | ||
...WpCoreGalleryBlockFragment | ||
innerBlocks { | ||
__typename | ||
...WpCoreImageBlockForGalleryFragment | ||
} | ||
} | ||
... on WpCoreColumnsBlock { | ||
innerBlocks { | ||
...WpColumnFields | ||
innerBlocks { | ||
...WpCoreImageBlockFragment | ||
...WpCoreGalleryBlockFragment | ||
... on WpCoreColumnsBlock { | ||
innerBlocks { | ||
...WpColumnFields | ||
innerBlocks { | ||
...WpCoreImageBlockForGalleryFragment | ||
...WpCoreGalleryBlockFragment | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const wpColumnFields = gql` | ||
fragment WpColumnFields on WpCoreColumnBlock { | ||
__typename | ||
saveContent | ||
dynamicContent | ||
isDynamic | ||
attributes { | ||
__typename | ||
} | ||
} | ||
`; | ||
|
||
export const WpCoreImageBlockFragment = gql` | ||
fragment WpCoreImageBlockFragment on WpCoreImageBlock { | ||
__typename | ||
saveContent | ||
originalContent | ||
attributes { | ||
__typename | ||
... on WpCoreImageBlockAttributes { | ||
id | ||
alt | ||
caption | ||
width | ||
title | ||
height | ||
linkTarget | ||
url | ||
imageFluid { | ||
childImageSharp { | ||
gatsbyImageData(quality: 100, layout: FULL_WIDTH) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const WpCoreImageBlockForGalleryFragment = gql` | ||
fragment WpCoreImageBlockForGalleryFragment on WpCoreImageBlock { | ||
__typename | ||
saveContent | ||
attributes { | ||
__typename | ||
... on WpCoreImageBlockAttributes { | ||
id | ||
alt | ||
caption | ||
width | ||
title | ||
height | ||
linkTarget | ||
url | ||
imageFluid { | ||
childImageSharp { | ||
full: gatsbyImageData(quality: 100, layout: FULL_WIDTH) | ||
thumbnail: gatsbyImageData(layout: CONSTRAINED) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
export const WpCoreParagraphBlockFragment = gql` | ||
fragment WpCoreParagraphBlockFragment on WpCoreParagraphBlock { | ||
__typename | ||
saveContent | ||
isDynamic | ||
dynamicContent | ||
} | ||
`; | ||
|
||
export const WpCoreGalleryBlockFragment = gql` | ||
fragment WpCoreGalleryBlockFragment on WpCoreGalleryBlock { | ||
dynamicContent | ||
attributes { | ||
... on WpCoreGalleryBlockAttributes { | ||
align | ||
anchor | ||
ids | ||
caption | ||
images { | ||
id | ||
url | ||
link | ||
alt | ||
caption | ||
} | ||
className | ||
} | ||
} | ||
} | ||
`; |
Oops, something went wrong.