mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Fixed unnecessary requests with loading comment counts
refs https://github.com/TryGhost/Team/issues/2082 - if a site has comments enabled but doesn't use the `comments_count` helper, the comments-count.min.js will still be loaded and it'll send a POST request to Ghost with an empty array of post IDs to fetch - this is unnecessary and we should avoid this extra request for pages that don't need to show comment counts - this commit prevents the comment-counts JS from sending the request if there are no post IDs to fetch
This commit is contained in:
parent
6b7088ba20
commit
fd9401503b
1 changed files with 4 additions and 0 deletions
|
@ -63,6 +63,10 @@
|
|||
const ids = Array.from(fetchingIds);
|
||||
fetchingIds.clear();
|
||||
|
||||
if (!ids.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rawRes = await fetch(api, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
|
Loading…
Reference in a new issue