Is your page opening really slow in the Sitecore Content Editor?
I recently had an issue where one page (the homepage) of a site opened really slow in the Sitecore Content Editor. All other pages went very smooth, so it was clearly something particular to that page. And when I mean slow, I mean you click on the item and it takes one coffee for the editor to react. On the published site, there was no issue.
At first this was just annoying, but after a while you curious and annoyed and you want this fixed.
Debugging
<!-- EVENT MAPS
events.timingLevel =
none - No timing information is logged for any of the events (no matter what their local settings are)
low - Start/end timing is logged for events with handlers. Local settings override.
medium - Start/end timing is logged for all events. Local settings override.
high - Start/end timing is logged for all events. Also, start/end for each handler is logged. Local settings override.
custom - Only local settings apply. Events without settings are not logged.
-->
<events timingLevel="custom">
Long running operation
20204 11:29:46 DEBUG Long running operation: renderContentEditor pipeline[id={98E57B60-071A-44D1-A763-B6C1BCE0C630}]
20204 11:29:48 DEBUG Long running operation: getLookupSourceItems pipeline[item=/sitecore/templates/Feature/.../CtaRenderingParameters/__Standard Values, source=query:/$site/Data/.../*]
20204 11:29:50 DEBUG Long running operation: getLookupSourceItems pipeline[item=/sitecore/templates/Feature/.../CtaRenderingParameters/__Standard Values, source=query:/$site/Data/.../*]
20204 .....
20204 11:30:19 DEBUG Long running operation: getLookupSourceItems pipeline[item=/sitecore/templates/Feature/.../CtaRenderingParameters/__Standard Values, source=query:/$site/Data/.../*]
20204 11:30:19 DEBUG Long running operation: Running Validation Rules
Apparently we have a long running operation getLookupSourceItems and we are not doing this once, but a dozen times on the home page. This is our cause - and ok, I exaggerated when I said a coffee but even a minute feels long to open an item.
query:/$site/Data/Link Types/*
I am not writing Sitecore queries every day so I admit it took me a few minutes to figure out what was wrong with this thing. It looks like a normal query that fetches all items in a certain path. And it's just a small detail, but a significant one: the first slash should not be there
query:$site/Data/Link Types/*
This works much smoother and the issue was fixed.
$site
We are using a resolveToken in the source. In the Sitecore docs you will find the list of available tokens and we are using $site here to get the path to the current site.
But that path will already start with a slash. So although you (probably) want your query to start with a slash, you do not want it to start with two. As described in the query axes, one slash will give you the children (and will form one path) but two will give all descendants. And that is in most cases a very costly operation.
No comments:
Post a Comment