meta object definition created by app not being destroyed on uninstall

meta object definition created by app not being destroyed on uninstall

CarBar
Shopify Partner
11 0 2

In my app I am adding a meta object definition like so.  

 

mutation {
metaobjectDefinitionCreate(definition: {
type: "$app:sometypename",

...
}
}

 

this results in an outcome of:

 

{
    "metaobjectDefinitionCreate": {
        "metaobjectDefinition": {
            "id": "gid://shopify/MetaobjectDefinition/1234",
            "type": "app--1234567--sometypename",
            "fieldDefinitions": [
                {
                    "key": "name",
                    "name": "Name",
                    "type": {
                        "name": "single_line_text_field"
                    }
                },

 

with the --1234567-- part being my app's ID. 
 
When I uninstall the app,  I would assume that this definition along with any data contained within that definition type would be destroyed,  however on attempting to reinstall the app I get an error when recreating the definition:
 

 

{
    "metaobjectDefinitionCreate": {
        "metaobjectDefinition": null,
        "userErrors": [
            {
                "field": [
                    "definition",
                    "type"
                ],
                "message": "Type has already been taken"
            }
        ]
    }
}

 

 

Is this intentional behaviour?  I wonder if it is in fact a bug given that:

a) if the definition for the meta object is private,  then you can't even see it in the admin, it's only accessable within the app via the api calls. 

b) there are other entities such as shipping carriers and fulfillment services which when created by the app get destroyed when uninstalling the app.   So it seems as though there's a patter which this particular element doesn't follow.

I've also noticed the same when creating a delivery profile via my app.  When uninstalling the app, the delivery profile doesn't get destroyed.   Howveer in this case you can go in and manually remove it so as to not have any issues when trying to recreate it again with the same name on a subsequent reinstall. 

Replies 0 (0)