What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

How to trigger page change on theme editor?

How to trigger page change on theme editor?

Shiref
Shopify Partner
11 0 1

Hello, I'm building a shopify theme that is supposed to be a single page application SPA, I implement my redirections to work with history API so no full page redirections are done. however, I have an issue that when I navigate from let's say home page to product page. I call history.replaceState with the new URL. but this doesn't reflect in theme editor. theme editor sidebar still shows details of the homepage and doesn't detect that I already navigated to another page. 

so, how can I trigger page change in theme editor? aka: shopify.designMode

Replies 2 (2)

Liam
Community Manager
3108 344 895

Hi Shiref,

 

Is this behaviour only happening in the theme editor - ie: the live store is working as expected? As you've seen this specific use-case may not be compatible with the theme editor due to how it's configured. 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Shiref
Shopify Partner
11 0 1

Hi Liam, 

yes this behavior happens only in theme editor, in frontend I get redirected normally (as a SPA, with history.pushState), and in theme editor I get redirected normally too. but the issue is the sidebar which carries settings of current page doesn't recognize this redirection and still shows the old page. even if current page shown is another page in theme editor. hope you got what I mean.