microsoft / AdaptiveCards

A new way for developers to exchange card content in a common and consistent way.
https://adaptivecards.io
MIT License
1.75k stars 550 forks source link

[Designer] Rendering of template with some complex field does not update while sample data is updated #8790

Closed benjguin closed 4 months ago

benjguin commented 10 months ago

Problem Description

While updating the sample data, the rendering does not update correctly for the Target Object field.

I provide a simplified version of the JSON card below that reproes the issue with the following data

{
    "data": {
        "task": {
            "start_date": "01.02.2023",
            "target": ["ABC", "DEF"]
        }
    }
}

see 4th screenshot

The first three screenshots were done a few months back.

Card JSON

{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.6",
    "msTeams": {
        "width": "default"
    },
    "body": [
        {
            "type": "ColumnSet",
            "columns": [
                {
                    "type": "Column",
                    "items": [
                        {
                            "type": "ColumnSet",
                            "columns": [
                                {
                                    "width": "100px",
                                    "verticalContentAlignment": "Top",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "spacing": "None",
                                            "text": "Target Object",
                                            "isSubtle": true,
                                            "weight": "Bolder"
                                        }
                                    ],
                                    "type": "Column"
                                },
                                {
                                    "width": "stretch",
                                    "verticalContentAlignment": "Center",
                                    "items": [
                                        {
                                            "type": "Container",
                                            "items": [
                                                {
                                                    "type": "TextBlock",
                                                    "$data": "${$root.data.task.target}",
                                                    "text": "${$data}"
                                                }
                                            ]
                                        }
                                    ],
                                    "type": "Column"
                                }
                            ],
                            "$when": "${count(data.task.target) > 0 }"
                        },
                        {
                            "type": "ColumnSet",
                            "columns": [
                                {
                                    "width": "100px",
                                    "verticalContentAlignment": "Center",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "spacing": "None",
                                            "text": "Start Date:",
                                            "isSubtle": true,
                                            "weight": "Bolder"
                                        }
                                    ],
                                    "type": "Column"
                                },
                                {
                                    "width": "stretch",
                                    "verticalContentAlignment": "Center",
                                    "items": [
                                        {
                                            "type": "TextBlock",
                                            "spacing": "None",
                                            "text": "${data.task.start_date}",
                                            "isSubtle": true
                                        }
                                    ],
                                    "type": "Column"
                                }
                            ]
                        }
                    ],
                    "width": "stretch"
                }
            ]
        }
    ],
    "actions": [
        {
            "type": "Action.OpenUrl",
            "title": "Open",
            "url": "${data.task.url}",
            "style": "positive",
            "id": "${data.task.task_uid}"
        }
    ]
}

Screenshot

1/ 1

2/ 2

3/ 3

4/ ko

anna-dingler commented 4 months ago

Hi @benjguin,

This is by design. When you are not in preview mode, only basic text blocks will be rendered for ease of designing. To view more complex data parsing, you need to enter preview mode (your third photo).

This behavior can also be observed in one of our cards that parses data for a FactSet. Design Mode: image

Preview Mode: image

Let me know if you have any questions!