Skip to content

Commit

Permalink
Fix #547: Empty placeholder content is shown after for a newly added …
Browse files Browse the repository at this point in the history
…page version
  • Loading branch information
napernik committed Feb 26, 2018
1 parent 0220d68 commit 6322367
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Composite/Data/PageManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
Expand Down Expand Up @@ -197,21 +197,24 @@ public static ReadOnlyCollection<IPagePlaceholderContent> GetPlaceholderContent(
public static ReadOnlyCollection<IPagePlaceholderContent> GetPlaceholderContent(Guid pageId, Guid versionId)
{
string cacheKey = GetCacheKey<IPagePlaceholderContent>(pageId, versionId);
var cachedValue = _placeholderCache.Get(cacheKey);
if (cachedValue != null)
var result = _placeholderCache.Get(cacheKey);

if (result == null)
{
return cachedValue;
}
using (var conn = new DataConnection())
{
conn.DisableServices();

var list = DataFacade.GetData<IPagePlaceholderContent>(false)
.Where(f => f.PageId == pageId
&& f.VersionId == versionId).ToList();
var list = DataFacade.GetData<IPagePlaceholderContent>(false)
.Where(f => f.PageId == pageId && f.VersionId == versionId).ToList();

var readonlyList = new ReadOnlyCollection<IPagePlaceholderContent>(list);
result = new ReadOnlyCollection<IPagePlaceholderContent>(list);
}

_placeholderCache.Add(cacheKey, readonlyList);
_placeholderCache.Add(cacheKey, result);
}

return readonlyList;
return result;
}

#endregion Public
Expand Down

0 comments on commit 6322367

Please sign in to comment.