Theme App Embed available_if not updating immediately in Theme Editor after app-data metafield change

I’m using an app-data metafield to conditionally render a Theme App Extension embed block using the available_if property. The functionality partially works, but the Theme Editor visibility is delayed and inconsistent.

I’m setting an app-data metafield on the app installation using the Admin GraphQL API:

const shopIdResponse = await admin.graphql(`
  {
    currentAppInstallation {
      id
    }
  }
`);
const appData = await shopIdResponse.json();
const appInstallationId = appData.data.currentAppInstallation.id;

await admin.graphql(
  `#graphql
  mutation CreateAppDataMetafield($metafieldsSetInput: [MetafieldsSetInput!]!) {
    metafieldsSet(metafields: $metafieldsSetInput) {
      metafields {
        id
        namespace
        key
      }
      userErrors {
        field
        message
      }
    }
  }`,
  {
    variables: {
      metafieldsSetInput: [
        {
          namespace: "assistant_settings",
          key: "embed_enabled",
          type: "boolean",
          value: payload.embed_enabled.toString(),
          ownerId: appInstallationId
        }
      ]
    }
  }
);

Then in my Theme App Extension embed block schema:

"available_if": "{{ app.metafields.assistant_settings.embed_enabled }}"

Expected behavior

The embed block should immediately appear or disappear in both the storefront and Theme Editor when the metafield value changes.

Actual behavior

The app-data metafield updates immediately, and the storefront reflects the change correctly. However, the Theme Editor does not update right away. The embed block visibility remains outdated for several minutes before eventually reflecting the correct state.

This behavior was working correctly until a few days back, and changes used to reflect almost immediately.

Any guidance would be appreciated.

Thanks!

Hi @saloneebhavsar

Your implementation does appear to be correct for conditional app embeds with app-data metafields. Has this behaviour only started happening recently?

@Liam-Shopify Yes, it was working properly before, but this issue has started occurring over the past couple of days.

Hi @Liam-Shopify, just chiming in to say this is happening for me too!

The app-data metafield itself is updating correctly, however it takes several minutes (6-7 minutes in my last test) for the conditional app embed to become available or unavailable in the theme editor.

Interestingly, the app embed does disappear instantly from the front-end when available_if changes to false – the block is still listed as an available block in the theme editor itself though.

This has been happening since the start of the year for me. I don’t believe it was happening before then.

Hi @Liam-Shopify

Following up on this as well, it takes up to 15 minutes(!). My BFS review is getting rejected because they don’t see the app embed even though the API returns that is set to true.

I’ve been trying to replicate this locally and I can confirm that it is very out of sync. This is going to cause a lot of confusion to customers.

Could this be looked into?