U4-3638 - U7 - Preview mode seems permanent and shows incorrect content on front of website, when using same browser as admin login

Created by Chris Evans 21 Nov 2013, 16:12:38 Updated by Shannon Deminick 12 Dec 2013, 06:31:54

Installed a clean U7.0.0 release today. Set up a simple Home doctype and Home content item, with a single Heading field on it.

When running the site in two tabs (in Firefox 25.0.1), showing the front of the website in one and the Umbraco admin in the other - if I hit preview, and then refresh the first tab at the front of the site, it shows the temporary, previewed content, not the published content. Even hitting Save and Publish doesn't seem to cause the content to update, it still shows the preview content.

Viewing the site in another browser, eg Chrome, it shows the correct published content. So I'm guessing it's something to do with the session or cookie state of the preview content mode, in the browser that is logged in as the admin user.

This isn't great because many clients will do what I'm doing, i.e. have the front and back open in the same browser, and jump between the two. If they think the live site is showing unpublished preview content, and doesn't fix itself when hitting save and publish again, they will freak out.

Comments

Shannon Deminick 25 Nov 2013, 02:41:39

This functionality hasn't changed since 4.x. To close the preview mode you need to click on the button:

http://screencast.com/t/vBaPpL6IV

The state is controlled by a cookie. If you click 'save', not Save and publish and hit preview again you will see the preview update it's state.

This is also related to this logged issue: http://issues.umbraco.org/issue/U4-3404

I don't think we should be clearing the preview cookie when save/publish is pressed again since that might also confuse people since they will already think they are in preview mode. That said, if you click save and publish and then preview it should show the newly saved content.


Chris Evans 26 Nov 2013, 02:13:24

Ah ha, that's interesting - in my installation, I wasn't seeing the preview ribbon. This could be why I got confused with why the preview wasn't able to be disabled.

My templates were super simple out of the box ones, Master looked like this:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @

@RenderBody()

and Home looked like:

@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @{ Layout = "Master.cshtml"; }

@CurrentPage.Heading

Once I dropped in an HTML5 doctype, standard html, head and body tags in the Master, the preview button appeared.

So less of an issue if the preview ribbon is there as that will make it obvious and also allow preview to be disabled. But even so like you say, if Save and Publish is clicked the preview content should probably be updated too.


Per Ploug 05 Dec 2013, 08:31:55

Well, I dont think this has changed since in V6, but by default a "save" wont update the preview, since its a quite costly operation to perform, since we need to regenerate all the xml for the cache - so it would slow down all save actions performed.

We could probably detect if the site was in preview mode when saving, and then regenerate the cache the same way we would update the normal published cached file.


Per Ploug 05 Dec 2013, 08:32:56

For the ribbon, it will only be added if it has a tag to attach itself to, which I dont see a reason to change for now


Shannon Deminick 05 Dec 2013, 11:30:07

@Per Yup that make total sense. I think the intended plan was to change the label of 'preview' to be 'save and preview' so that it always saves/regenerates the instance before previewing again - i think that combined with detecting in preview mode will solve the entire issue.


Shannon Deminick 12 Dec 2013, 06:31:54

I've fixed this by detecting if your are in preview mode when you are re-saving/publishing and it will regenerate the preview xml.

I have not change the button to "Save and publish" though, the publish button will continue to do the same thing - if not in preview mode it will generate new xml, if in preview mode it will just show you the front-end with the existing preview xml. (so of course now if you click Save or Publish the preview xml will be updated too)


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.0.0

Due in version: 7.0.1

Sprint:

Story Points:

Cycle: