OS2.0 app blocks from previous app installation reappear when app is reinstalled

OS2.0 app blocks from previous app installation reappear when app is reinstalled

axis80
Shopify Partner
23 1 9

When an app is uninstalled, its app blocks disappear from the theme customizer.  When that same app is reinstalled, the app blocks from the previous installation reappear with their settings intact.  There appears to be no way for me as an app developer to programmatically delete them either on uninstall or reinstall.

 

Can anyone from Shopify tell me whether this is intentional behavior?  It's less than ideal for my use case, as my app block previews contain app-generated images that are deleted from my CDN on app uninstall.  When the app is reinstalled, the images are missing.  I can work around this by showing demo images in the theme customizer, but my preference would be for the blocks to disappear entirely on app uninstall.

 

Thanks to anyone who can provide some feedback on this 🙂

Reply 1 (1)

axis80
Shopify Partner
23 1 9

I may have jumped the gun with the above post.  According to Shopify's documentation on app webhooks:

 

"48 hours after a store owner uninstalls your app, Shopify sends a payload on the shop/redact topic. This webhook provides the store's shop_id and shop_domain so that you can erase data for that store from your database."

 

My takeaway from that is that I should be waiting for that webhook before removing the store's data from my database and CDN, instead of removing those things immediately when the app is uninstalled.

 

It's not clear to me whether Shopify also deletes my app's metadata and app blocks from the customer's store at the same time they send the shop/redact webhook.  I will have to do some testing on that, and will report back here when I figure it out.