After migrating our metaobject definitions to TOML files, I noticed a mismatch between metaobjectsCount and the number of metaobjects I can actually query.
This happens specifically when a metaobject definition is removed from TOML and then added back again.
query Metaobjects {
metaobjects(type: “$app:custom”, first: 100) {
edges {
node {
id
handle
definition {
id
displayNameKey
metaobjectsCount
}
}
}
}
}
-
The definition.metaobjectsCount reports 46.
-
But the metaobjects query only returns 10 entries, and pageInfo.hasNextPage is false.
-
This started happening after migrating the metaobject definition to TOML.
Questions:
-
Is this expected behavior after migrating to TOML?
-
Is there a way to query archived / unreferenced enteries / pre-migration metaobjects so the count and results match?
-
Or should metaobjectsCount only reflect entries that are actually retrievable under the new TOML-managed definition?
Thanks for any clarification!
Hi @Its_Atif – apologies for the confusion here.
When removing a definition from TOML, we don’t immediately delete underlying metafield or metaobject values. There is a buffer period before clean-up begins. This matches the behaviour of app uninstall, which you might be familiar with: if a merchant changes their mind and quickly reinstalls your app, the data isn’t lost. For the TOML definitions, we do the same thing, in case of a mistaken change to your app.
To address your question, I think the right option is (3). We’ll try to get that in place soon – thanks for flagging this!
Hi team, thanks for clarifying the behavior earlier
I tested another case:
-
I removed a metaobject definition from TOML.
-
Then I added back the same definition again in TOML without app unistall or changing anything.
-
However, the behavior stayed the same — all the previous metaobject entries are gone and not restored except the count.
A couple of things I’d like to clarify:
-
Is there any way to recover those previously created metaobjects after re-adding the definition?
(e.g., are they only temporarily inaccessible, or are they effectively wiped when the definition is removed and then re-added?)
-
If a definition is permanently removed from TOML, is there a way to still manage or access those metaobjects via the API (without keeping the definition in TOML)? Or does removing it from TOML mean they will eventually be cleaned up and fully deleted?