Open smarcet opened 2 months ago
Same here,
for me this is a rather big problem. I would appreciate a fix for this on CMS side.
Can the team acknowledge this and probably hint at how we can get this fixed?
also related to #7120
i ended up with a work around exports.createResolvers = ({ createResolvers, pathPrefix }) => { const resolvers = { MemberSpotliteSectionJsonCompanies: { companyImagePublicURL: { type: "String", resolve: async (source, args, context) => { console.log("createResolvers", source); const node = await context.nodeModel.findOne({ query: { filter: { base: { eq: source?.image }, }, }, type: "File", }); console.log("createResolvers entries", node); if (!node) return source.memberCompany.big_logo;
const { absolutePath } = node;
const { ext, name } = path.parse(absolutePath);
const filename = `${name}--${node.internal.contentDigest}${ext}`;
const newPath = path.join(publicStaticDir, filename);
try {
const exists = await fs.exists(newPath);
if (!exists) await fs.copy(absolutePath, newPath);
return `${pathPrefix}/static/${filename}`;
} catch (e) {
console.error(
`error copying file from ${absolutePath} to ${newPath}`,
e,
);
}
return source.memberCompany.big_logo;
},
},
},
}; createResolvers(resolvers); };
Hello i created a simple image field at cms when i deleted the image from cms admin its sets to empty on my json file { image:"} and start to got this error message Field "image" must not have a selection since type "String" has no subfields Please replace with a clear and descriptive title from graphql queries at page there is a way to tell the widget to remove the field from json file
i already have the custom type defined gastby-node.js
at exports.createSchemaCustomization like this
and graphql query at page is
also i tried to create a custom resolver at gastby node.js exports.createResolvers