Skip to content

Commit 99b8b62

Browse files
committed
Fix: do not refer to unexistent fragments
1 parent 4394ea0 commit 99b8b62

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

packages/optimizely-cms-sdk/src/graph/createQuery.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ import { AnyProperty } from '../model/properties.js';
22
import {
33
AnyContentType,
44
MAIN_BASE_TYPES,
5-
MediaStringTypes,
65
PermittedTypes,
76
} from '../model/contentTypes.js';
87
import {
98
getContentType,
109
getAllContentTypes,
1110
getContentTypeByBaseType,
12-
getAllMediaTypeKeys,
1311
} from '../model/contentTypeRegistry.js';
1412
import {
1513
getKeyName,
@@ -129,15 +127,6 @@ function convertPropertyField(
129127
}
130128
extraFragments.push(...createFragment(key, visited));
131129
subfields.push(`...${key}`);
132-
133-
// if the key name is one of the user defined media type we append the base type fragment
134-
// eg: userDefinedImage (baseType:"image") -> _image
135-
if (getAllMediaTypeKeys().includes(key)) {
136-
const cc = getContentType(key);
137-
if (cc) {
138-
subfields.push(`...${cc.baseType.trim()}`);
139-
}
140-
}
141130
}
142131

143132
const uniqueSubfields = ['__typename', ...new Set(subfields)].join(' '); // remove duplicates

packages/optimizely-cms-sdk/src/model/contentTypeRegistry.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { isBaseMediaType } from '../util/baseTypeUtil.js';
21
import { AnyContentType } from './contentTypes.js';
32

43
let _registry: AnyContentType[] = [];
@@ -22,8 +21,3 @@ export function getAllContentTypes(): AnyContentType[] {
2221
export function getContentTypeByBaseType(name: string): AnyContentType[] {
2322
return _registry.filter((c) => c.baseType === name) as AnyContentType[];
2423
}
25-
26-
/** Get the Component from a content type name */
27-
export function getAllMediaTypeKeys() {
28-
return _registry.filter((c) => isBaseMediaType(c.baseType)).map((c) => c.key);
29-
}

0 commit comments

Comments
 (0)