Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
432 stars 130 forks source link

[Bug]: Duplicate auto-generated text in .json files when working across multiple stores #4767

Open EvilestVirus7 opened 6 days ago

EvilestVirus7 commented 6 days ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

When using the Shopify CLI with the --theme-editor-sync flag, the tool should correctly generate and synchronize content without duplicating or adding multiple redundant sections of auto-generated text across JSON files. The CLI should respect the integrity of the theme files and ensure that no unwanted or duplicate content is introduced when working with multiple stores.

Actual behavior

The CLI is generating duplicated or even more than double entries of auto-generated texts when using the --theme-editor-sync flag. This issue occurs when working on multiple stores, causing the insertion of unwanted changes into theme files. As a result, files contain redundant auto-generated text, which then requires manual cleanup and commits with undesired content. Image Image

Verbose output

2024-10-29T15:08:55.626Z: Initiating theme asset reconciliation process ╭─ info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ The files listed below differ between the local and remote versions. What would you like to do? │ │ • config/settings_data.json │ │ • config/settings_schema.json │ │ • locales/de.json │ │ • locales/en.default.json │ │ • locales/es.json │ │ • locales/fr.json │ │ • locales/it.json │ │ • locales/ja.json │ │ • locales/nb.json │ │ • locales/pt-BR.json │ │ • locales/tr.json │ │ • sections/footer-group.context.australia.json │ │ • sections/footer-group.json │ │ • sections/header-group.context.australia.json │ │ • sections/header-group.context.ca.json │ │ • sections/header-group.json │ │ • sections/overlay-group.context.ca.json │ │ • sections/overlay-group.json │ │ • templates/404.json │ │ • templates/article.camping-blog.json │ │ • templates/article.json │ │ • templates/blog.camping-blog.json │ │ • templates/blog.json │ │ • templates/cart.json │ │ • templates/collection.accesoires.json │ │ • templates/collection.best-sellers.json │ │ • templates/collection.brand.json │ │ • templates/collection.camping-cube.json │ │ • templates/collection.camping.json │ │ • templates/collection.custom.json │ │ • templates/collection.json │ │ • templates/collection.parts.json │ │ • templates/collection.pf-6d60d8f1.json │ │ • templates/collection.professional-canopies.json │ │ • templates/collection.work-cube-industrial.json │ │ • templates/customers/account.json │ │ • templates/customers/activate_account.json │ │ • templates/customers/addresses.json │ │ • templates/customers/login.json │ │ • templates/customers/order.json │ │ • templates/customers/register.json │ │ • templates/customers/reset_password.json │ │ • templates/index.context.australia.json │ │ • templates/index.context.ca.json │ │ • templates/index.json │ │ • templates/list-collections.json │ │ • templates/page.about-us.json │ │ • templates/page.apply.json │ │ • templates/page.booking-laval-fr.json │ │ • templates/page.camping.json │ │ • templates/page.canopies.context.ca.json │ │ • templates/page.canopies.json │ │ • templates/page.collabs.json │ │ • templates/page.commercial-shelters.json │ │ • templates/page.contact.json │ │ • templates/page.custom-canopies.json │ │ • templates/page.custom-flags-banners.json │ │ • templates/page.custom-graphics.context.ca.json │ │ • templates/page.custom-graphics.json │ │ • templates/page.customer-reviews.json │ │ • templates/page.e-z-up-experience.json │ │ • templates/page.event-system.json │ │ • templates/page.faq.json │ │ • templates/page.graphic-dpt.json │ │ • templates/page.help.json │ │ • templates/page.industrial.json │ │ • templates/page.inflatables.json │ │ • templates/page.json │ │ • templates/page.list-collections.json │ │ • templates/page.nos-clients.json │ │ • templates/page.parts.json │ │ • templates/page.postulez.json │ │ • templates/page.pro-grade.json │ │ • templates/page.professional-canopies.json │ │ • templates/page.quiz-fr.json │ │ • templates/page.quiz.json │ │ • templates/page.recycled.json │ │ • templates/page.ressellers.json │ │ • templates/page.share-your-story.json │ │ • templates/page.skyfuze.json │ │ • templates/page.sports.json │ │ • templates/page.store-locations.json │ │ • templates/page.team.json │ │ • templates/page.video-v2.json │ │ • templates/page.video.json │ │ • templates/page.warranty-claim-form.json │ │ • templates/page.work-cube.json │ │ • templates/password.json │ │ • templates/product.accesories.json │ │ • templates/product.camping-cube-sport.json │ │ • templates/product.camping-cube.json │ │ • templates/product.contact.json │ │ • templates/product.context.united-kingdom.json │ │ • templates/product.custom-shelters.json │ │ • templates/product.custom.json │ │ • templates/product.inflatables.json │ │ • templates/product.json │ │ • templates/product.on-sale.json │ │ • templates/product.pre-order.json │ │ • templates/product.quick-view.json │ │ • templates/product.skyfuze.json │ │ • templates/search.json │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

? Reconciliation Strategy:

Keep the remote version

Keep the local version

Press ↑↓ arrows to select, enter to confirm.

Reproduction steps

  1. Start by working on multiple Shopify stores, each with its own theme setup.

  2. Open the command line interface and navigate to the theme directory for one of the stores.

  3. Use the Shopify CLI command: shopify theme dev --theme-editor-sync

  4. When the CLI prompts for a reconciliation strategy, select local version to avoid using files from another store.

  5. Repeat these steps across different stores, ensuring that each store's theme is being worked on separately but within the same Shopify CLI session.

  6. Observe the JSON files in the theme directory after each session. Notice that duplicate (or more) entries of auto-generated text appear in the JSON files due to the --theme-editor-sync parameter.

Operating System

Windows 11 and Mac

Shopify CLI version (check your project's package.json if you're not sure)

3.69.3

Shell

bash

Node version (run node -v if you're not sure)

v20.17.0

What language and version are you using in your application?

No response

lukeh-shopify commented 3 days ago

👋🏻 Hi @EvilestVirus7, thanks for reporting this issue! We have recently shipped a potential solution to this. Would you please upgrade to the latest version of the CLI and let us know if you're still encountering the issue? Thanks!


If you're still having issues, could you please clarify some questions I had about the reproduction steps?

Start by working on multiple Shopify stores, each with its own theme setup. Open the command line interface and navigate to the theme directory for one of the stores.

Does this mean, given you have store A and store B, you have the following two directories on your local machine?

a-theme-files/
b-theme-files/

Does each directory contain the files for the current live theme of each store?

Use the Shopify CLI command: shopify theme dev --theme-editor-sync

Are you not providing the --store flag here? How are you sure that you are working on the correct store when running this command?

Repeat these steps across different stores, ensuring that each store's theme is being worked on separately but within the same Shopify CLI session.

Are you running this in one directory, and then ending the dev session before changing to the next directory and starting the dev session up again?