Problem/Motivation

Every ACT on-demand endpoint (comment fragment, branch fragment, context fragment, delivery, filter, refresh) calls CommentIndexRepository::load(), which runs an unbounded Entity Query for all comments on the node and loads every one, then runs a per-comment access check and a full tree build. Fetching one comment's fragment costs loading all 216 comments plus 216 access checks. Loading part of the tree is therefore O(total comments), not O(slice), and a single Expand All or filter run multiplies that cost by the number of requests it fires.

Steps to reproduce

  • Open a node with 200+ comments under ACT.
  • Request one comment fragment, e.g. /node/581/advanced-comment-threads/comment_node_blog/comment/1617/full.
  • Observe the server queries and loads every comment on the node, not just the requested slice.

Proposed resolution

  • Bound load() and the fragment/branch/delivery endpoints to the requested ids plus their full ancestor chains plus their direct children - 0(slice + depth), still a large win, and it preserves the ancestry access filter at CommentIndexRepository.php:158-173, which drops any comment whose parent chain contains an inaccessible comment. Bound only to the requested ids would silently remove that security control and would also break level, ancestor_ids, and child_count.
  • Ensure the refresh path, which legitimately needs all ids, remains cheap (ids + metadata) and does not render every comment.

Remaining tasks

  • Confirm partial-thread requests are O(slice) via a real 200+ comment thread.

User interface changes

None, beyond faster partial-thread loading.

API changes

The fragment/branch/delivery endpoints should honor an id slice = ids + ancestors + direct children, so a partial-thread request is bounded.

Data model changes

None anticipated.

Comments

freelock created an issue. See original summary.

freelock’s picture

Issue summary: View changes

Added context to the summary to cover the case when a comment ancestor becomes unpublished or inaccessible, to also hide all descendant comments.

  • freelock committed 6bb4f18f on 1.0.x
    fix: #3622839 On-demand fragment endpoints rebuild the full comment...
freelock’s picture

freelock’s picture

Status: Active » Fixed

Mark it fixed!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.