Skip to content

Commit

Permalink
Performance improvement & nullability fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanLieckens committed Aug 8, 2024
1 parent 6683b66 commit 0aa6cf1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
return;
}

if (IsInEditingMode(renderingContext) && IsPlaceHolderEmpty(placeholderFeatures))
bool emptyEdit = IsInEditingMode(renderingContext) && IsPlaceHolderEmpty(placeholderFeatures);
if (emptyEdit)
{
output.Content.AppendHtml("<div class=\"sc-empty-placeholder\">");
}
Expand Down Expand Up @@ -102,7 +103,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu
output.Content.AppendHtml(html);
}

if (IsInEditingMode(renderingContext) && IsPlaceHolderEmpty(placeholderFeatures))
if (emptyEdit)
{
output.Content.AppendHtml("</div>");
}
Expand All @@ -115,7 +116,7 @@ public override async Task ProcessAsync(TagHelperContext context, TagHelperOutpu

private static bool IsInEditingMode(ISitecoreRenderingContext renderingContext)
{
return renderingContext?.Response?.Content?.Sitecore?.Context?.IsEditing ?? false;
return renderingContext.Response?.Content?.Sitecore?.Context?.IsEditing ?? false;
}

private static bool IsPlaceHolderEmpty(Placeholder placeholderFeatures)
Expand Down

0 comments on commit 0aa6cf1

Please sign in to comment.