cli: [Bug]: Local server never updates with local changes & intermittently displays live theme

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 starting a local development server using the command:

shopify theme dev -s store-handle --theme-editor-sync --live-reload full-page

…and viewing the page at localhost, the local machine version of the theme should be displayed and any changes made locally, should be viewed when a hot reload takes place.

Actual behavior

Either one of two issues happens (seems to have been happening for the past 3/4 CLI versions):

  1. When the development server is started (with the command previous), sometimes the live theme will be displayed.

or

  1. The theme displayed is correct, but when making changes locally, hot reload simply reloads the same state and fails to show any updated code/visuals and thus the domain-based preview link needs to be used (example.com/pages/about?preview_theme_id=1234567890) - localhost/127 never works.

Verbose output

DEBUG `-> 200 request_id: 45180b82-c70b-4795-8b99-1759ed8702d4-1713349026
DEBUG Proxying GET https://example-store-url.myshopify.com/products/white-tropical-family-swimsuits.js?_fd=0&pb=0
DEBUG `-> 200 request_id: 99c5251c-53ab-4d66-ae04-5571076996d5-1713349026
DEBUG Proxying GET https://example-store-url.myshopify.com/products/mom-me-black-cheetah-high-waisted-bikini-1.js?_fd=0&pb=0
DEBUG Proxying GET https://example-store-url.myshopify.com/products/blush-leopard-bikini-swimsuit.js?_fd=0&pb=0
DEBUG `-> 200 request_id: 184782fa-4bd7-462e-b564-fe13431b71d9-1713349026
DEBUG Proxying GET https://example-store-url.myshopify.com/products/mom-me-baseball-mom-mini-fringe-top.js?_fd=0&pb=0
DEBUG `-> 200 request_id: 93720ac7-2802-47b6-8f38-431be8a35d4b-1713349026
DEBUG Proxying GET https://example-store-url.myshopify.com/products/mom-me-rust-polka-dot-cheetah-bikini.js?_fd=0&pb=0
DEBUG `-> 200 request_id: b4ae2ca6-4b2d-4e72-ac45-a627bb7a79e0-1713349027
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.js?_fd=0&pb=0
DEBUG `-> 200 request_id: 6411c44d-d4b5-4e9a-8156-5cf269f3bf00-1713349027
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.json?_fd=0&pb=0
DEBUG `-> 200 request_id: 37232444-737b-4851-8d46-359422f08f7f-1713349027
DEBUG `-> 200 request_id: 08526dcf-90c6-4da1-a186-d3515ef349c1-1713349027
DEBUG `-> 200 request_id: 3fb6d70c-5bbc-41b7-889c-6502f0316b87-1713349027
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.js?_fd=0&pb=0
DEBUG `-> 200 request_id: 9a31a100-9891-4455-9480-7db74e6b6cf8-1713349027
DEBUG `-> 200 request_id: c64d9af3-d1b4-48b6-8f0c-aabb0d04189e-1713349027
DEBUG `-> 200 request_id: 909b763a-1f84-4291-8a7b-8a9d0b6e0d36-1713349027
DEBUG Proxying GET https://example-store-url.myshopify.com/apps/loggedincustomer?_fd=0&pb=0
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.js?_fd=0&pb=0
DEBUG `-> 200 request_id: cf3e0ba0-90f7-43e0-a8da-41381360bbe2-1713349027
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.js?_fd=0&pb=0
DEBUG GET https://example-store-url.myshopify.com/admin/api/unstable/themes/127904415818/assets.json with request_id: 3667f175-16ec-4406-be2e-9a2a9ce58aa1-1713349027
DEBUG ignore package.json
DEBUG `-> 200 request_id: 7486e35c-969e-4599-984d-08b5e87bba16-1713349028
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.js?_fd=0&pb=0
DEBUG `-> 200 request_id: f4b51b28-4893-4076-8e00-b8e2707b86ef-1713349028
DEBUG Proxying GET https://example-store-url.myshopify.com/cart.js?_fd=0&pb=0
DEBUG `-> 200 request_id: e0f7d4ef-c733-4554-9f3b-92341a335e6f-1713349028
DEBUG `-> 401 request_id: 98340977-91c4-4aff-871f-ca1455672ac3-1713349027
DEBUG GET https://example-store-url.myshopify.com/admin/api/unstable/themes/127904415818/assets.json with request_id: 81fd6dc3-8660-4713-9dee-c641fe363b0d-1713349031
DEBUG ignore package.json

Reproduction steps

  1. Run shopify theme dev -s store-handle --theme-editor-sync --live-reload full-page
  2. Make a local change
  3. Browser will refresh
  4. No change is shown until the shopify url is used.

Operating System

macOS 14.4.1 & Windows 10

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

3.59.0

Shell

zsh / Git Bash

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

v21.7.3

What language and version are you using in your application?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

This happened with me few weeks ago and it was showing the live store preview on http://127.0.0.1:9292/ But I used http://127.0.0.1:9292?preview_theme_id=id-here then it worked fine

👋 hi @rcasimmons, thanks for reaching out! the behavior your experiencing in the CLI is because of this flag your passing in: --live-reload full-page

removing this will run theme dev with the default live-reload mode which is hot-reload. you should then see your local changes reflected in your preview. let us know if you’re still having trouble after trying this 🙏

Thanks @mgmanzella for the response but I think you’ve misunderstood here.

The issue lies with changes just not being made to 127 - not that the page is simply refreshing - we’re fully aware the page is refreshing due to this flag.

This means, for example, if I were to edit a section that’s present on the homepage by say, changing the CSS’s background from black to white, the 127/localhost url wouldn’t then display the background as white and stay as black.

If I wanted to view these changes, I would have to use the shop’s url followed by a parameter of ‘preview_theme_id’ which we shouldn’t have to do - live reload is there for a reason.

The other issue lying with the fact that sometimes the live theme is being shown on 127/localhost and not the local theme.

The refresh flag is intentional in our case as to mitigate JS which will only run on load or whereby if the page breaks due to JS.

Same issue here. Crashed my head for a few days on that! THANK YOU @azeem-rainycity you are my HERO! preview_theme_id works.