We are introducing an experimental feature to help communities with a large number of categories.
For the past few months we have been working hard on making Discourse sites work better for communities with many categories (and not only!) This will allow administrators to create thousands of categories while keeping the friendly UX you are familiar with.
This is still an experimental feature and can be enabled by tweaking the lazy_loaded_categories_groups
site setting. It is currently disabled by default.
How does this work?
At the moment, all categories data is loaded when you navigate to a Discourse community. This is called “eager loading” and is not ideal for sites with many categories because it means a lot of information is transferred before the first render which increases the overall loading time.
The new method is called “lazy loading” and will defer loading information about a category until it is really necessary (for example, when searching for a category, navigating or linking one, reading a topic or post mentioning one, etc). Less data transferred means faster loading time and happier users!
What does this mean for you, as a member of Meta?
We have been heavily testing this feature internally, but given the extent of the work done, there is a slight chance of introducing bugs. If you notice anything malfunctioning related to categories, let us know as a reply to this topic or open a Bug topic.
What does this mean for you or your community?
Whether you are hosted by us or if you are self-hosted, this feature is disabled by default and there should be no visible changes.
However, if you are looking at extending your community to have many categories, we strongly encourage you to enable this feature.
In the future, we are going to enable it by default and eventually deprecate and remove the code that “eager loads” categories.
What does this mean for plugin and theme developers?
In general, there should be little to no changes necessary for most plugins, as long as they use the category components from core or preloaded data (for example, query only for categories that are already visible when loading the page, because that means they have been preloaded already).
Some problems may appear when trying to use information for categories that have not been loaded yet. Category.findByIds
method will continue to return only categories that have been loaded already, while Category.asyncFindByIds
may perform a lookup on the server if the information has not been loaded yet.