Browse Source

Speed: disable labels count for Ajax requests (#8352)

fix https://github.com/FreshRSS/FreshRSS/issues/8342
Alexandre Alapetite 3 months ago
parent
commit
b8c955583c
1 changed files with 6 additions and 1 deletions
  1. 6 1
      app/Controllers/indexController.php

+ 6 - 1
app/Controllers/indexController.php

@@ -149,8 +149,13 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
 		}
 
 		$this->view->callbackBeforeFeeds = static function (FreshRSS_View $view) {
-			$view->tags = FreshRSS_Context::labels(true);
 			$view->nbUnreadTags = 0;
+			if (Minz_Request::paramBoolean('ajax')) {
+				// Disable label counts for AJAX requests: faster and not needed
+				$view->tags = FreshRSS_Context::labels(precounts: false);
+				return;
+			}
+			$view->tags = FreshRSS_Context::labels(precounts: true);
 			foreach ($view->tags as $tag) {
 				$view->nbUnreadTags += $tag->nbUnread();
 			}