Skip to content

Commit

Permalink
fix(api-headless-cms): add field renderer resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel910 committed Jun 6, 2024
1 parent b2ce354 commit 5d3f831
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/api-headless-cms/src/graphql/schema/contentModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ export const createModelsSchema = ({ context }: Params): ICmsGraphQLSchemaPlugin
}
},
CmsContentModelField: {
renderer: field => {
// Make sure `settings` is an object.
if (field.renderer) {
// We're using `||` here, because we want to use the fallback value for both `undefined` and `null`.
return { ...field.renderer, settings: field.renderer.settings || {} };
}

return field.renderer;
},
tags(field) {
// Make sure `tags` are always returned as an array.
return Array.isArray(field.tags) ? field.tags : [];
Expand Down

0 comments on commit 5d3f831

Please sign in to comment.