Everyday after starting the project using CLI command, previous added data get missing as not saved

Everyday after starting the project using CLI command, previous added data get missing as not saved

MSSPL-sandipbis
Shopify Partner
3 0 0

I am trying to develop the whole site locally first with all the data. When I will be DONE, I will push it to live.

But everyday when I am starting the project using CLI command "shopify theme dev", I get to see that all my previous added data/content, is lost. Whereas the image files are still there in the media library. But none of the blocks retain their content in their respective fields.

How is all the data getting lost everyday? I am very much confused, is this a bug in Shopify? Please check the video link here to refer to my issue & help me out.

https://www.awesomescreenshot.com/video/22149841?key=68e18f91e66f383ff04878f2f44d7457

Replies 6 (6)

maxdanko
Shopify Partner
29 3 7

Before you run shopify theme dev you need to create a deleopment theme to pull your changes from the customizer using the shopify theme pull command and only then run shopify theme dev. Because when you save your changes in the customizer, your settings_data.json is not changed locally

MSSPL-sandipbis
Shopify Partner
3 0 0

Hello Maxdanko,

 

 

When I am developing locally using Shopify CLI then none of the data i have added during my work stays after push. All the data that i have added during development from local gets lost.

 

Thanks

maxdanko
Shopify Partner
29 3 7

Thank you for your reply. To solve this problem you should create a development theme in your store and upload your code there, then you need to open two shopify cli terminals in one run shopify theme dev --store [store-name.myshopify.com] --theme [your_theme id from store]. After making changes in customizer you need to run shopify theme pull --store [store-name.myshopify.com] --theme [your_theme id from store] to pull down the changes, and after re-running shopify theme dev ... your changes from the customizer will remain. The shopify theme dev command sends the changes you had in your code but does not take them out of the customizer

MSSPL-sandipbis
Shopify Partner
3 0 0

Hello Maxdanko,

 

In the live site when I am adding the content in the home-page, then those data are actually found in the file index.json, please check the screenshot below.

MSSPLsandipbis_0-1699603248396.png

 

 

But when I am working locally using Shopify CLI with local frontend url then after adding the data from the customize theme editor link, those data are not found in the index.json file, please check the screenshot below.

MSSPLsandipbis_1-1699603289833.png

 

 

The data in the index.json file are not getting generated when I am working locally using Shopify CLI. Can you please explain why?

 

 

Thanks

maxdanko
Shopify Partner
29 3 7

Because in your case cli creates a virtual development environment that is not related to the store, so the changes from the customizer will not be applied

WeAreCoast
Shopify Partner
1 0 0

For anyone that finds this question while looking for an answer. The answer is to use the --theme-editor-sync flag

--theme-editor-sync
env: SHOPIFY_FLAG_THEME_EDITOR_SYNC

Synchronize Theme Editor updates in the local theme files.

 

see doc https://shopify.dev/docs/api/shopify-cli/theme/theme-dev