DEV: Limit preloaded categories (#23958)

Site data is preloaded on the first page load, which includes categories
data. For sites with many categories, site data takes a long time to
serialize and to transfer.

In the future, preloaded category data will be completely removed.
This commit is contained in:
Bianca Nenciu
2023-10-17 22:04:56 +03:00
committed by GitHub
parent 2e68ead45b
commit bf97899029
2 changed files with 18 additions and 0 deletions

View File

@ -183,6 +183,17 @@ RSpec.describe Site do
DiscoursePluginRegistry.clear_modifiers!
end
end
context "when lazy_load_categories" do
before { SiteSetting.lazy_load_categories = true }
it "limits the number of categories" do
stub_const(Site, "LAZY_LOAD_CATEGORIES_LIMIT", 1) do
categories = Site.new(Guardian.new).categories
expect(categories.size).to eq(1)
end
end
end
end
it "omits groups user can not see" do