U4-9022 - Preview uses cached content

Created by Marc Goodson 27 Sep 2016, 10:56:59 Updated by Tom 09 Mar 2018, 09:33:16

Tags: Gold partner

If you preview a page in Umbraco, and the template it uses, has a Partial to display some of the properties pulled in using Html.CachedPartial...


@Html.CachedPartial("Person", Model, 8600, true, false)

Then the updated content the editor is trying to preview is not visibile until the cache expires.

Saving AND Publishing will break the cache, and then the editor can then preview the change, but it is too late at that point because they've published the page!!!

I'm wondering whether the HtmlHelperRenderExtensions CachedPartial extension could detect if it is executing in the context of preview and not return the cached version ?


or if it's just wrong to use a Cached Partial to write out properties in a template in this context, it's sort of an anti-pattern, but I can see why the developer has done it here for performance (they are using uSiteBuilder) and pulling in content for the person as well as the bodyText property.

Anyway the Editor expects to see the content they have just changed and saved and not published, rather than any cache of the current live page.. which I think is the issue I am raising here, if that makes sense ?


Shannon Deminick 29 Sep 2016, 11:45:43

A work around for now is do an if:

@if(UmbracoContext.InPreviewMode) { @Html.Partial("Person", Model, 8600, true, false) } else { @Html.CachedPartial("Person", Model, 8600, true, false) }

Darren Ferguson 29 Sep 2016, 11:48:22

Thanks @Shandem

Priority: Normal

Type: Bug

State: Submitted


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.3, 7.6.3

Due in version:


Story Points: