U4-5162 - Preview should not cache result of macro

Created by Sandor Voordes 30 Jun 2014, 16:46:54 Updated by Shannon Deminick 08 Jul 2015, 09:02:36

Although when in preview mode no result FROM the macro cache is used, the newly result of the macro is stored IN the macro cache. All subsequent normal page requests now show the previewed version with the unpublished content. I was able to determine this by testing and through code analysis on Umbraco 6.1.6.

In umbraco.macro >

GetMacroFromCache contains this check: UmbracoContext.Current.InPreviewMode == false && Model.CacheDuration > 0

AddMacroResultToCache does not contain this check.


Steve Farron 14 Nov 2014, 15:07:52

Issue also exists in 6.1.5. Noticed this on our homepage when incomplete content went live, even though it wasn't published. Editor mentioned using the preview feature and we were able to reproduce the problem.

James Collins 19 Feb 2015, 16:07:48

Still an issue in Umbraco v6.2.4. We've had to disable macro caching to deal with it.

Anyone who uses macro caching and the preview button is affected. Incomplete content is being displayed on live (without being published). Depending on the cache period, it can stay on live for some time (it reverts/rebuilds the cache when it expires).

Let's get this voted up so that it's addressed. It must be affecting a large number of installations.

Phil Dye 21 May 2015, 15:24:27

Also affects (as expected) v4, albeit that some method names are different. Fix should be around \src\Umbraco.Web\umbraco.presentation\macro.cs line 527

Phil Dye 21 May 2015, 15:38:30

Happy to fix and test this, but suspect a PR won't be accepted now for v4 and v6?

Tom Jenks 09 Jun 2015, 10:25:16

We're also seeing this on a site running 7.2.1, resulting in unpublished nodes showing in the navigation because it is being cached in the macro.

James Collins 09 Jun 2015, 19:00:57

Just for reference, there are a few of us discussing this over on our:


Please remember to vote this issue up if you'd like to see it fixed.

Stephan 15 Jun 2015, 12:45:39

Fixed: bef6b8cd4c55ffa90f88ae2bffd239a6f914cc60

Priority: Major

Type: Bug

State: Fixed

Assignee: Stephan

Difficulty: Easy


Backwards Compatible: True

Fix Submitted:

Affected versions: 4.11.10, 6.1.6, 6.2.1, 7.1.4

Due in version: 7.2.7


Story Points: