Files
klz-cables.com/.pnpm-store/v10/files/60/06e0f23184a0618d7a8d57e16dd17818a3baddc3036d16c57c7e396a44fcdc1ebb322674088eba042e7e3512c850bb2e3b3fe5ca3e315da42671d049f1a0dd
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

35 lines
883 B
Plaintext

import { GraphQLError } from '../../error/GraphQLError.mjs';
/**
* Unique fragment names
*
* A GraphQL document is only valid if all defined fragments have unique names.
*
* See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness
*/
export function UniqueFragmentNamesRule(context) {
const knownFragmentNames = Object.create(null);
return {
OperationDefinition: () => false,
FragmentDefinition(node) {
const fragmentName = node.name.value;
if (knownFragmentNames[fragmentName]) {
context.reportError(
new GraphQLError(
`There can be only one fragment named "${fragmentName}".`,
{
nodes: [knownFragmentNames[fragmentName], node.name],
},
),
);
} else {
knownFragmentNames[fragmentName] = node.name;
}
return false;
},
};
}