Shopify / cli

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

[Bug]: Override recent theme customizations (`--theme-editor-sync`) #4667

Open stijns96 opened 1 day ago

stijns96 commented 1 day ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

When running shopify theme dev --theme-editor-sync it should nicely sync everything between the local files and the theme editor.

Actual behavior

Although it's actually working, I'm getting the following modal every time I make changes to the theme and click on save.

Image

There is not difference between my local index.json and the one on Shopify (ghost theme).

Local

/*
 * ------------------------------------------------------------
 * IMPORTANT: The contents of this file are auto-generated.
 *
 * This file may be updated by the Shopify admin theme editor
 * or related systems. Please exercise caution as any changes
 * made to this file may be overwritten.
 * ------------------------------------------------------------
 */
{
  "sections": {
    "usp_demo": {
      "type": "usps",
      "blocks": {
        "usp_Ub6eJY": {
          "type": "usp",
          "settings": {
            "icon": "",
            "icon_size": "w-8",
            "heading": "Heading",
            "content": "<p>Content</p>",
            "button_label": "Label",
            "button_url": "shopify://collections",
            "button_type": ""
          }
        }
      },
      "block_order": [
        "usp_Ub6eJY"
      ],
      "settings": {
        "color_scheme": "",
        "container_width": "",
        "container_spacing": "my-[--container-spacing]"
      }
    }
  },
  "order": [
    "usp_demo"
  ]
}

Shopify

/*
 * ------------------------------------------------------------
 * IMPORTANT: The contents of this file are auto-generated.
 *
 * This file may be updated by the Shopify admin theme editor
 * or related systems. Please exercise caution as any changes
 * made to this file may be overwritten.
 * ------------------------------------------------------------
 */
{
  "sections": {
    "usp_demo": {
      "type": "usps",
      "blocks": {
        "usp_Ub6eJY": {
          "type": "usp",
          "settings": {
            "icon": "",
            "icon_size": "w-8",
            "heading": "Heading",
            "content": "<p>Content</p>",
            "button_label": "Label",
            "button_url": "#",
            "button_type": ""
          }
        }
      },
      "block_order": [
        "usp_Ub6eJY"
      ],
      "settings": {
        "color_scheme": "",
        "container_width": "",
        "container_spacing": "my-[--container-spacing]"
      }
    }
  },
  "order": [
    "usp_demo"
  ]
}

Verbose output

2024-10-17T08:05:35.715Z: Listening for changes in the theme editor 2024-10-17T08:05:38.991Z: Request to https://.myshopify.com/admin/api/unstable/themes//assets.json?fields=key%2Cchecksum completed in 273 ms With response headers:

2024-10-17T08:05:38.994Z: Reading the content of file at dist/templates/index.json... 2024-10-17T08:05:39.517Z: Request to https://.myshopify.com/admin/api/unstable/themes//assets.json?asset%5Bkey%5D=templates%2Findex.json completed in 520 ms With response headers:

2024-10-17T08:05:39.519Z: Writing some content to file at dist/templates/index.json... • 10:05:39 Synced » download templates/index.json from remote theme 2024-10-17T08:05:39.521Z: Listening for changes in the theme editor 2024-10-17T08:05:39.607Z: Reading the content of file at dist/templates/index.json... GET / 2024-10-17T08:05:39.623Z: → Rendering https://.myshopify.com/?_fd=0&pb=0 (with templates/index.json)... 2024-10-17T08:05:39.901Z: Request to https://.myshopify.com/?_fd=0&pb=0 completed in 277 ms With response headers:

2024-10-17T08:05:39.901Z: ← 200 (request_id: 278268c5-dc09-40ef-abc1-8354472051ac-1729152339) 2024-10-17T08:05:40.124Z: Request to https://.myshopify.com/admin/api/unstable/themes//assets/bulk.json completed in 516 ms With response headers:

• 10:05:40 Synced » update templates/index.json 2024-10-17T08:05:42.831Z: Request to https://.myshopify.com/admin/api/unstable/themes//assets.json?fields=key%2Cchecksum completed in 308 ms With response headers:

2024-10-17T08:05:42.833Z: Reading the content of file at dist/templates/index.json... 2024-10-17T08:05:42.833Z: Listening for changes in the theme editor 2024-10-17T08:05:46.047Z: Request to https://.myshopify.com/admin/api/unstable/themes//assets.json?fields=key%2Cchecksum completed in 212 ms With response headers:

2024-10-17T08:05:46.048Z: Listening for changes in the theme editor 2024-10-17T08:05:49.299Z: Request to https://.myshopify.com/admin/api/unstable/themes//assets.json?fields=key%2Cchecksum completed in 249 ms With response headers:

Reproduction steps

  1. Create or fork a theme
  2. Run it with shopify theme dev --theme-editor-sync
  3. Make changes in the theme editor and click save.

Operating System

macOS Sonoma 14.4.1

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

3.68.0

Shell

zsh

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

v20.10.0

What language and version are you using in your application?

ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]

Off topic

Additionally, I'm also always getting the question to keep the remote or local files in my CLI. Even tho I start the server fully ones, break it, and then spin it up again. Everything should already be synced, but still I'm getting the question. Maybe that's related?

MaxDesignFR commented 1 day ago

I also have this issue happen to me occasionally, even though I did not edit the local files in the first place. It seems clicking on Override and save changes has no unwanted effects in my case, meaning that I don't lose customizations or code. It is confusing for sure.

stijns96 commented 1 day ago

Hi @MaxDesignFR,

I'm also not updating the local files. Clicking Override and save changes is indeed what I'm also doing. Looks like that is the "normal" behaviour.