Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
stijns96 opened this issue Oct 17, 2024 · 6 comments
Open
2 tasks done

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

stijns96 opened this issue Oct 17, 2024 · 6 comments
Labels
Area: @shopify/theme @shopify/theme package issues #gsd:40767 Fortify local development experience for Liquid themes important second highest severity for theme related bug Type: Bug Something isn't working

Comments

@stijns96
Copy link

stijns96 commented Oct 17, 2024

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

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/<theme_id>/assets.json?fields=key%2Cchecksum completed in 273 ms
With response headers:

  • content-type: application/json; charset=utf-8
  • server-timing: processing;dur=88, cfRequestDuration;dur=247.000217
  • x-request-id: a3d20dec-7cd5-4900-8fdd-52db6d420679-1729152338

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/<theme_id>/assets.json?asset%5Bkey%5D=templates%2Findex.json completed in 520 ms
With response headers:

  • content-type: application/json; charset=utf-8
  • server-timing: processing;dur=158, cfRequestDuration;dur=312.000036
  • x-request-id: 7efd7fac-8aa1-4dcb-83db-a6e83a24e5e3-1729152339

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:

  • cache-control: no-cache, no-store
  • content-type: text/html; charset=utf-8
  • server-timing: processing;dur=76, db;dur=21, db_async;dur=5.274, edge_cart;dur=1.49;desc="trips=1", parse;dur=1, render;dur=12, asn;desc="201290", edge;desc="AMS", country;desc="NL", theme;desc="<theme_id>", pageType;desc="index", servedBy;desc="js7r", requestID;desc="278268c5-dc09-40ef-abc1-8354472051ac-1729152339", cfRequestDuration;dur=222.000122
  • x-request-id: 278268c5-dc09-40ef-abc1-8354472051ac-1729152339

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/<theme_id>/assets/bulk.json completed in 516 ms
With response headers:

  • content-type: application/json; charset=utf-8
  • server-timing: processing;dur=336, cfRequestDuration;dur=498.999834
  • x-request-id: 6cf5ac10-af3e-43a3-8e55-1153941cfaf8-1729152339

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

  • content-type: application/json; charset=utf-8
  • server-timing: processing;dur=67, cfRequestDuration;dur=209.999800
  • x-request-id: a08f90c7-76d9-48ae-b4ea-f9d6ae72bd41-1729152342

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/<theme_id>/assets.json?fields=key%2Cchecksum completed in 212 ms
With response headers:

  • content-type: application/json; charset=utf-8
  • server-timing: processing;dur=50, cfRequestDuration;dur=197.999954
  • x-request-id: bb3285ce-c6c0-49a7-9585-39d1c19037e4-1729152345

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/<theme_id>/assets.json?fields=key%2Cchecksum completed in 249 ms
With response headers:

  • content-type: application/json; charset=utf-8
  • server-timing: processing;dur=78, cfRequestDuration;dur=223.999977
  • x-request-id: bb51e115-769e-4642-b114-93a1052af343-1729152349

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?

@stijns96 stijns96 added the Type: Bug Something isn't working label Oct 17, 2024
@MaxDesignFR
Copy link

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
Copy link
Author

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.

@lucyxiang lucyxiang added Area: @shopify/theme @shopify/theme package issues #gsd:40767 Fortify local development experience for Liquid themes important second highest severity for theme related bug labels Oct 17, 2024
@roman-yakobnyuk
Copy link

I am running into this issue also in local development, when running the following command it causes infinite loop of constantly changing config files back and forth:

shopify theme dev -e develop --theme-editor-sync

Even pushing and pulling the theme fully doesn't work. It seems like a header gets generated when the JSON file is pulled by the CLI but is removed when pushed to the Shopify server. This creates a difference in files that is always detected and causes a sync loop.

@karreiro
Copy link
Contributor

Thank you for reporting this issue, @stijns96.

I've noticed the button_url seems different between both versions. If you update that item, do you still encounter the scenario you've reported?

Thanks again for reporting this!

@MaxDesignFR
Copy link

MaxDesignFR commented Oct 25, 2024

Just to add more context to this issue, I regularly have to Override and save changes right after I click Save on the theme editor. It's not always like that, but when it happens, clicking Save is always followed by Override and save changes, even though I do not interact with the local files in between.

So it gets quite annoying when it does that because you need to interact twice to save (save + override and saves changes) for every consecutive change in the theme editor. I will share verbose as soon as I encounter this, happens basically everyday for me.

@steplabsxyz
Copy link

I have this issue too.

Every time you save for the 2nd time, it shows an error on the shopify CLI.

How do I fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/theme @shopify/theme package issues #gsd:40767 Fortify local development experience for Liquid themes important second highest severity for theme related bug Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants