chore: opt out of caching getGraphql and getFieldSchemaMap

This commit is contained in:
Jarrod Flesch
2024-03-05 09:25:36 -05:00
parent 2785eaab21
commit 0e378be769
2 changed files with 6 additions and 2 deletions

View File

@@ -51,6 +51,10 @@ if (!cached) {
} }
export const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => { export const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {
if (process.env.NODE_ENV === 'development') {
cached = global._payload_graphql = { graphql: null, promise: null }
}
if (cached.graphql) { if (cached.graphql) {
return cached.graphql return cached.graphql
} }
@@ -110,7 +114,7 @@ export const POST =
} }
return response return response
}, },
schema: schema, schema,
validationRules: (request, args, defaultRules) => defaultRules.concat(validationRules(args)), validationRules: (request, args, defaultRules) => defaultRules.concat(validationRules(args)),
})(originalRequest) })(originalRequest)

View File

@@ -12,7 +12,7 @@ if (!cached) {
} }
export const getFieldSchemaMap = (config: SanitizedConfig): FieldSchemaMap => { export const getFieldSchemaMap = (config: SanitizedConfig): FieldSchemaMap => {
if (cached) { if (cached && process.env.NODE_ENV !== 'development') {
return cached return cached
} }