cli: [Bug]: Shopify CLI keeps refreshing when theme-editor-sync = true

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

Theme

Expected behavior

Running shopify theme dev --theme-editor-sync should start the live-preview server, and update code within the dev customizer in both directions.

Actual behavior

Despite having the same templates/index.json file locally and on the development theme, a choice appears:

The local file templates/index.json is different from the remote version in the development theme.
? What would you like to do? (Choose with ↑ ↓ ⏎, filter with 'f')
> 1. Keep the remote version
  2. Keep the local version
  3. Merge files (it may break the local file)
  4. Exit

Verbose output

Whatever choice is used, the live-preview gets stuck in an infinite get/update loop:

  • 11:13:25 Synced » get templates/index.json                                                                                                                                                               
  • 11:13:26 Synced » update templates/index.json                                                                                                                                                            
  • 11:13:29 Synced » get templates/index.json                                                                                                                                                               
  • 11:13:29 Synced » update templates/index.json
  • 11:13:32 Synced » get templates/index.json
  • 11:13:33 Synced » update templates/index.json
  • 11:13:36 Synced » get templates/index.json
  • 11:13:36 Synced » update templates/index.json

and so on

Reproduction steps

This happens on a specific store, but not on others. Will be hard to reproduce on a different store, as I don’t know the cause of the issue.

Operating System

Ubuntu 20.04

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

@shopify/cli/3.53.0

Shell

bash

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

node-v18.19.0

What language and version are you using in your application?

No response

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Reactions: 6
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I recently had this within the team. For us it was Unicode hiding in plain sight. A U+2028 LINE SEPARATOR character got inserted when copying multiline text from, e.g., Figma, into a single-line text box in the theme editor. Getting rid of the extra ‘invisible’ Unicode characters causes the loop to stop for us.

image

The loop also happens if U+2028 is inserted unescaped. It won’t show up in VS Code, however on opening the file for the first time you should get prompted to ignore or remove the LS/PS characters.

@ahmedbm27 @iPhenan I found a temporary bandaid, if the issue is related to a single file like me. You can add flag ignore = [“templates/index.json”] (or whatever file is problematic) and you’ll be able to use customizer sync again (except the ignored file)

Same issue on Apple M1, MacOS 14.2.1 since Shopify CLI version 3.52.0

I’m facing the identical issue with the following:

  • Operating System: Ubuntu 23.04
  • Node.js version: v21.5.0
  • Shopify CLI version: Tested with both 3.52.0 and 3.53.0