Skip to content

Commit 1d4ca93

Browse files
committed
Rename "compositon" > "__composition"
1 parent ebb3723 commit 1d4ca93

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/optimizely-cms-sdk/src/infer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ export type InferFromProperty<T extends AnyProperty> =
105105
export type InferredBase = {
106106
_id: string;
107107
_metadata: InferredContentMetadata;
108+
109+
// Properties that don't come from Graph are prefixed with double-underscores
108110
__typename: string;
109111
__context?: { edit: boolean; preview_token: string };
110-
composition?: ExperienceComponentNode;
112+
__composition?: ExperienceComponentNode;
111113
};
112114

113115
/** Only include keys where indexingType is not 'disabled' */

packages/optimizely-cms-sdk/src/react/server.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ type OptimizelyComponentProps = {
8484
/** Preview context */
8585
__context?: { edit: boolean; preview_token: string };
8686

87-
composition?: ExperienceCompositionNode;
87+
__composition?: ExperienceCompositionNode;
8888
};
8989

9090
displaySettings?: Record<string, string>;
@@ -98,7 +98,8 @@ export async function OptimizelyComponent({
9898
if (!componentRegistry) {
9999
throw new Error('You should call `initReactComponentRegistry` first');
100100
}
101-
const dtKey = opti.composition?.displayTemplateKey ?? opti.displayTemplateKey;
101+
const dtKey =
102+
opti.__composition?.displayTemplateKey ?? opti.displayTemplateKey;
102103
const Component = await componentRegistry.getComponent(opti.__typename, {
103104
tag: opti.__tag ?? getDisplayTemplateTag(dtKey),
104105
});
@@ -261,7 +262,7 @@ export function OptimizelyGridSection({
261262
<OptimizelyComponent
262263
opti={{
263264
...node.component,
264-
composition: node,
265+
__composition: node,
265266
__tag: tag,
266267
}}
267268
key={node.key}

0 commit comments

Comments
 (0)