Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit dd1b216

Browse files
committed
add isPreview parameter to ConvertValueToContent method, to prevent caching of preview data
1 parent 28e4bc4 commit dd1b216

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Our.Umbraco.DocTypeGridEditor/Helpers/DocTypeGridEditorHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ namespace Our.Umbraco.DocTypeGridEditor.Helpers
1818
public static class DocTypeGridEditorHelper
1919
{
2020

21-
public static IPublishedElement ConvertValueToContent(string id, string contentTypeAlias, string dataJson)
21+
public static IPublishedElement ConvertValueToContent(string id, string contentTypeAlias, string dataJson, bool isPreview = false)
2222
{
2323
if (string.IsNullOrWhiteSpace(contentTypeAlias))
2424
return null;
2525

2626
if (dataJson == null)
2727
return null;
2828

29-
if (Current.UmbracoContext == null)
29+
if (Current.UmbracoContext == null || isPreview)
3030
return ConvertValue(id, contentTypeAlias, dataJson);
3131

3232
return (IPublishedElement)Current.AppCaches.RuntimeCache.GetCacheItem(

src/Our.Umbraco.DocTypeGridEditor/Web/Controllers/DocTypeGridEditorApiController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public HttpResponseMessage GetPreviewMarkup([FromBody] PreviewData data, [FromUr
183183
}
184184

185185
// Get content node object
186-
var content = DocTypeGridEditorHelper.ConvertValueToContent(data.Id, data.ContentTypeAlias, data.Value);
186+
var content = DocTypeGridEditorHelper.ConvertValueToContent(data.Id, data.ContentTypeAlias, data.Value, true);
187187

188188
// Construct preview model
189189
var model = new PreviewModel

0 commit comments

Comments
 (0)