Commit 0f8d747 1 parent fc06a4e commit 0f8d747 Copy full SHA for 0f8d747
File tree 1 file changed +24
-14
lines changed
packages/gatsby-plugin-mdx/gatsby
1 file changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -93,20 +93,30 @@ module.exports = function createSchemaCustomization(
93
93
}
94
94
}
95
95
96
- const processMDX = ( { node } ) =>
97
- genMDX ( {
98
- node,
99
- options,
100
- store,
101
- pathPrefix,
102
- getNode,
103
- getNodes,
104
- cache,
105
- reporter,
106
- actions,
107
- schema,
108
- ...helpers ,
109
- } )
96
+ const pendingPromises = new WeakMap ( )
97
+ const processMDX = ( { node } ) => {
98
+ let promise = pendingPromises . get ( node )
99
+ if ( ! promise ) {
100
+ promise = genMDX ( {
101
+ node,
102
+ options,
103
+ store,
104
+ pathPrefix,
105
+ getNode,
106
+ getNodes,
107
+ cache,
108
+ reporter,
109
+ actions,
110
+ schema,
111
+ ...helpers ,
112
+ } )
113
+ pendingPromises . set ( node , promise )
114
+ promise . then ( ( ) => {
115
+ pendingPromises . delete ( node )
116
+ } )
117
+ }
118
+ return promise
119
+ }
110
120
111
121
// New Code // Schema
112
122
const MdxType = schema . buildObjectType ( {
You can’t perform that action at this time.
0 commit comments