Skip to content

Commit 53aa3a4

Browse files
Merge pull request #1425 from araver/master
Add Sample Data to Adaptive Card Editor
2 parents 7112cbd + 7d033e5 commit 53aa3a4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/controls/adaptiveCardDesignerHost/AdaptiveCardDesigner.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps): JSX
186186
props.context);
187187

188188
convertNullToEmptyString(dataObject);
189+
cardDesigner.sampleData = dataObject?.$root || {};
189190
cardDesigner.dataStructure = FieldDefinition.deriveFrom(dataObject.$root);
190191
}, [isMonacoLoaded,
191192
props.addDefaultAdaptiveCardHostContainer,

src/controls/adaptiveCardHost/AdaptiveCardHost.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,11 @@ export const AdaptiveCardHost = (props: IAdaptiveCardHostProps): JSX.Element =>
153153
currentAdaptiveCard.parse(cardPayload, serializationContextInstanceRef.current);
154154

155155
const renderedElement = currentAdaptiveCard.render();
156-
currentRenderElement.innerHTML = "";
157-
currentRenderElement.appendChild(renderedElement);
158-
159-
// just for debugging pourpouse
160-
console.log(evaluationContext);
161-
// *****
156+
// If this isn't acceptable, we should compare the old template with the new template
157+
if (renderedElement.outerHTML !== currentRenderElement.innerHTML) {
158+
currentRenderElement.innerHTML = "";
159+
currentRenderElement.appendChild(renderedElement);
160+
}
162161
} catch (cardRenderError) {
163162
if (props.onError) {
164163
props.onError(cardRenderError);

0 commit comments

Comments
 (0)