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
Shopify Staff
2862 312 813

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.