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!