메타에서 실험적 'lazy_loaded_categories' 기능 활성화

:information_source: 이 프로젝트는 당분간 보류되었습니다. 향후 재검토할 수 있으며, 그렇게 되면 여기에 업데이트를 게시하겠습니다.

많은 수의 카테고리를 가진 커뮤니티를 돕기 위해 실험적 기능을 도입합니다. :rocket:

지난 몇 달간 우리는 많은 수의 카테고리를 가진(그리고 그 외에도!) 커뮤니티에서 Discourse 사이트가 더 잘 작동하도록 열심히 작업해 왔습니다. 이를 통해 관리자는 친숙한 사용자 경험(UX)을 유지하면서 수천 개의 카테고리를 만들 수 있게 됩니다.

이것은 여전히 실험적 기능이며, lazy_loaded_categories_groups 사이트 설정을 조정하여 활성화할 수 있습니다. 현재 기본적으로 비활성화되어 있습니다.

:gear: 이 기능은 어떻게 작동합니까?

현재 Discourse 커뮤니티로 이동할 때 모든 카테고리 데이터가 로드됩니다. 이를 “즉시 로딩(eager loading)”이라고 하며, 많은 카테고리를 가진 사이트에는 이상적이지 않습니다. 첫 번째 렌더링 전에 많은 양의 정보가 전송되어 전체 로딩 시간이 증가하기 때문입니다.

새로운 방법은 “지연 로딩(lazy loading)”이라고 불리며, 카테고리에 대한 정보를 실제로 필요할 때까지(예: 카테고리 검색, 이동 또는 링크, 해당 카테고리를 언급하는 주제나 게시물 읽기 등) 로드하는 것을 지연시킵니다. 전송되는 데이터가 적을수록 로딩 시간이 빨라지고 사용자는 더 만족합니다! :star:

:discourse: Meta의 멤버인 여러분에게 이것이 무엇을 의미합니까?

우리는 이 기능을 내부적으로 철저히 테스트해 왔지만, 수행된 작업의 규모를 고려할 때 버그가 도입될 가능성이 약간 있습니다. 카테고리와 관련된 이상 증상이 발견되면 이 주제에 답글을 달거나 Contribute > Bug 주제를 열어 알려주세요.

:people_holding_hands: 여러분이나 여러분의 커뮤니티에 이것이 무엇을 의미합니까?

우리가 호스팅을 제공하는 경우든 자체 호스팅을 하는 경우든, 이 기능은 기본적으로 비활성화되어 있으며 눈에 띄는 변화가 없어야 합니다.

그러나 커뮤니티를 확장하여 많은 카테고리를 가질 계획이라면 이 기능을 활성화하는 것을 강력히 권장합니다.

미래에는 이 기능을 기본적으로 활성화하고, 궁극적으로 카테고리를 “즉시 로딩”하는 코드를 비추천(deprecate)하고 제거할 것입니다.

:technologist: 플러그인 및 테마 개발자에게 이것이 무엇을 의미합니까?

일반적으로 대부분의 플러그인에는 거의 또는 전혀 변경이 필요하지 않을 것입니다. 단, 코어의 카테고리 컴포넌트나 사전 로드된 데이터를 사용하는 경우입니다(예: 페이지 로드 시 이미 표시되는 카테고리에만 쿼리를 실행하는 것. 이는 이미 사전 로드되었음을 의미하므로).

아직 로드되지 않은 카테고리에 대한 정보를 사용하려고 할 때 일부 문제가 발생할 수 있습니다. Category.findByIds 메서드는 이미 로드된 카테고리만 반환하는 반면, Category.asyncFindByIds는 정보가 아직 로드되지 않은 경우 서버에서 조회를 수행할 수 있습니다.

44개의 좋아요

The category information seems to be missing when you use one of the links below a post to navigate to a topic in a different category. I opened Contributing translations to Discourse in a new tab and navigated to Switching from Transifex to Crowdin, then it looks like this:


After a reload, the category appears.

6개의 좋아요

After I posted my #site-feedback:theme-feedback topic, the category badge was missing for topics of that category

4개의 좋아요

The search function within the composer is unable to determine if there is a matching category.

3개의 좋아요

Is that also related to the lazy loaded categories?

2개의 좋아요

Yes. I have disabled the lazy_load_categories for the time being because it was breaking the docs plugin.

5개의 좋아요

We have re-enabled this experiment here. What has been fixed since it was last enabled:

  • Categories in the header are populated correctly, especially when navigating from a topic to another using post links or suggested topics

  • Badges styling will show correctly after creating a new topic in a category that was not navigated to before

  • Docs plugin preloads categories data, so /docs page is now rendered correctly

  • Other bugs that have been discovered through internal review

The only outstanding bug is about the missing search results for certain queries (short queries or queries that contain only stop words).

We wanted to make search more powerful and have extended the full-text search engine to categories, and this is an unwanted side effect. I think we will have to revert the previous search algorithm, but we’re still investigating this.

7개의 좋아요

The categories of category moderators at /about are missing

And when I look at my drafts the categories are missing too.

The activity page of a group or user and the notifications in my profile like https://meta.discourse.org/my/notifications/responses do not load categories

When you open the composer to start a new topic with a link in a message or by clicking new message in your inbox and using the envelope at the top left of the composer to change the draft into a new topic draft, there is no option to choose a category.

8개의 좋아요

When you open /categories, not all subcategories of Documentation are shown (#documentation:theme-developers disappears after reload until I click Documentation).

And autocomplete for searching categories does not work. Most of the categories do not show after reload

3개의 좋아요

The categories are also missing at the list of related topics.

And when I visited the topics to load the categories for the second screenshot, I noticed that at the second #announcements:blog topic, the category below the topic title was missing. I assume this isn’t important because it shouldn’t happen when the related topics work.

4개의 좋아요

This does seem to be causing an issue in one of my plugins on 3.2.1 stable.

When I inspect Site.current().categories and lazy loading is enabled, I do see (only) the categories I need (like the category for the current topic), but all preloaded_category_custom_fields seem to be missing.

They do appear when I turn off lazy loading (together with all the other categories).

So the correct category is being preloaded but it misses its preloaded fields.

1개의 좋아요

This has been fixed. :white_check_mark:

Fixed too. :white_check_mark:

Fixed as well. :white_check_mark:

The other problems are being currently worked on. Thank you so much for your feedback, @Moin.

It depends how the categories were loaded. I agree that there are probably some code paths that may lead to partial category data being loaded. I will communicate with the team about this issue, but since we are moving towards a state where the frontend will have to request the data they need before accessing it.

Is it a public plugin? If yes, I can have a look at it. In general, the most popular plugins we have required very little changes to make them work when “lazy load categories” is enabled.

3개의 좋아요

The color of the parent category is still missing


2개의 좋아요

It’s happening in a regular topic view.

The only thing that might be special is that the code is in an initializer, in a widget that is attached to the post-contents:before widget. The plugin is not public but I can give you access if you PM me your Github username. Alternatively I can send you a PM with a tar.gz, which might be easier. The plugin is old and not originally written by me but I don’t see anything that’s obviously wrong either.

So how will that work? I can understand the binary situation where a category is there or where it is not there. But if I encounter a category without a specific custom field, how do I know if the custom field is absent or if it is just not fully loaded yet?

i.e. this should never be happening!

1개의 좋아요

So can you please help me out with this one @nbianca ?

When lazy loading is enabled, the custom fields are missing from the category object here in my public private replies plugin.

      if ((siteSettings.private_replies_on_selected_categories_only == false) || (topic?.category?.custom_fields?.private_replies_enabled)) {
        return this.currentUser && ((this.currentUser.id == topic_owner_id) || this.currentUser.staff);
      }

and I have no idea how to get them.

I’m adding the field to the preloaded category custom fields.

Site.preloaded_category_custom_fields << 'private_replies_enabled'

I am discussing this with the team internally, but I think we will have to revise how we preload categories for topics.

2개의 좋아요

I found another spot where categories are missing: the AI search results.

2개의 좋아요

When I refresh meta.discourse.org and select + New Topic, the topic template fails to appear. Initially, as demonstrated in the video, everything functions correctly. However, after reloading, the template is absent. Once I open the composer again, everything resumes working as expected.

Note: If you have Support in your sidebar, you must remove it prior to reloading.

1개의 좋아요

Based and scalability-pilled.