Forum Discussion

jesspoemape's avatar
jesspoemape
Copper Contributor
Oct 16, 2023

setCachePolicy not disabling cache on link unfurl

Hello. I'm building a bot in node.js, and I want to disable caching of adaptive cards on link unfurl. According to the docs, it should be disabled if I include the setCachePolicy like so: 

return {
      composeExtension: {
        type: 'result',
        attachmentLayout: 'list',
        attachments: attachments,
        suggestedActions: {
          actions: [
            {
              type: 'setCachePolicy',
              value: { type: 'no-cache' },
            },
          ],
        },
      },
    }

 

However, it seems like the cards are still cached. For example:

- I paste a link to unfurl

- The link unfurls into an adaptive card

- I send the adaptive card to the channel

- I make changes in the code to change the layout of the adaptive card

- I paste the same link to unfurl

Expectation: the unfurled adaptive card displays the latest code. 

Actual: the unfurled adaptive card displays the outdated code.

 

Any ideas why this might be happening? Am I setting the setCachePolicy wrong? 

  • jesspoemape -We have tried with the below code; it is working fine at our end.
    Could you please try to use the below code and confirm the same?


    {
      "composeExtension": {
        "type": "result",
        "attachmentLayout": "list",
        "attachments": [
          {
            "preview": {
              "contentType": "application/vnd.microsoft.card.adaptive",
              "content": previewPayload
            },
            "contentType": "application/vnd.microsoft.card.adaptive",
            "content": cardPayload
          }
        ],
        "suggestedActions": {
          "actions": [
            {
              "type": "setCachePolicy",
              "value": "{\"type\":\"no-cache\"}"
            }
          ]
        }
      }
    }

     

Resources