File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ const SENTRY_API_SCHEMA_SHA = 'deea76e7205d4e1efb45f91796b9fc73499de226';
14
14
15
15
const activeEnv = process . env . GATSBY_ENV || process . env . NODE_ENV || 'development' ;
16
16
17
+ let cachedResonse : DeRefedOpenAPI | null = null ;
18
+
17
19
async function resolveOpenAPI ( ) : Promise < DeRefedOpenAPI > {
18
20
if ( activeEnv === 'development' && process . env . OPENAPI_LOCAL_PATH ) {
19
21
try {
@@ -27,10 +29,16 @@ async function resolveOpenAPI(): Promise<DeRefedOpenAPI> {
27
29
) ;
28
30
}
29
31
}
32
+
33
+ if ( cachedResonse ) {
34
+ return cachedResonse ;
35
+ }
30
36
const response = await fetch (
31
- `https://raw.githubusercontent.com/getsentry/sentry-api-schema/${ SENTRY_API_SCHEMA_SHA } /openapi-derefed.json`
37
+ `https://raw.githubusercontent.com/getsentry/sentry-api-schema/${ SENTRY_API_SCHEMA_SHA } /openapi-derefed.json` ,
38
+ { cache : 'no-store' }
32
39
) ;
33
- return await response . json ( ) ;
40
+ cachedResonse = await response . json ( ) ;
41
+ return cachedResonse ! ;
34
42
}
35
43
36
44
export type APIParameter = {
You can’t perform that action at this time.
0 commit comments