-
Notifications
You must be signed in to change notification settings - Fork 333
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
"Preview mode": Page reloads after navigation #2756
Comments
What's happening is that when you click on a new page, the CMS picks up that it's not the same as the page you were editing. So it actually navigates to the edit form for the page you're now previewing. You can see this in action if you use the split mode instead of the preview mode. The way to avoid this is, as you've noted, to not use It might be worth us having some UX advice on this though - when in preview mode it does indeed look like a bug since you can't see that the edit form has changed. Maybe we need a toast message when this happens... |
Ah, I had wondered if it was something like that, but forgot to try split view. I'm not sure a toast will really help though, as depending on a specific site's page load experience this issue will be different for every site. e.g more notifiable on slow servers or sites with on-load animations or actions. I can see users not necessarily linking the toast with the observed behaviour (e.g. repeating page animation), and of course, it doesn't actually fix the odd behaviour. Removing An ideal solution here is to just stop the CMS from re-loading the preview when it doesn't have to. The CMS must already detect the change in the |
The preview panel is tied directly to the edit form template. With the way it's currently architectured, we can't change what form we're looking at without also loading a new preview panel. |
Ah ok, I wondered if that could be the case. Would it be complicated to tell it to not update the edit form when navigating the preview (unless in Split mode), and the edit form update could instead be triggered when changing from Preview mode back to Edit mode (or when Draft/Published toggle is changed). It wouldn't fix the issue on Split mode but would eliminate unnecessary Edit form loads and as such also the unnecessary Preview loads. |
That's definitely a clean option, and I don't think it would be too difficult. We'd just need a mechanism to store a pending edit form location when in preview mode, and check that when swapping modes. |
When editing a page in the CMS, if you open "Preview mode" and then click a link to navigate to another page, the new page loads, but then immediately reloads a split second later.
On some sites this is more noticeable than others, and on sites with on-load transitions, it is especially annoying as it looks like the transition occurs twice.
It seems to be related to the presence of
$MetaTags(false)
in the template, as if you remove this line the reload issue doesn't occur.This can be easily reproduced in a clean Silverstripe 4.11.0 install. To make the issue more obvious, you can add a transition to the body, e.g. add this to the
head
intemplates/Page.ss
.Here you can see the pages load twice:
If you remove
$MetaTags(false)
the issue goes away:The text was updated successfully, but these errors were encountered: