Summary
PostsUserPage builds its PostListState with the intended per-request page size passed into the wrong constructor parameter, which makes the loadLimit field dead code. It is currently harmless, but the code is misleading and is a latent trap.
Details
framework/core/js/src/forum/components/PostsUserPage.tsx:
/** The number of activity items to load per request. */
loadLimit: number = 20;
oninit(...) {
// ...
this.posts = new PostListState({}, this.loadLimit);
}
PostListState's constructor signature (via PaginatedListState) is (params, page = 1, pageSize = null). So this.loadLimit (20) is passed as the page argument, not pageSize, even though the field is documented as the per-request item count.
Current behavior
It happens to be inert today, for two reasons:
- The constructor sets
location = { page: 20 }, but show() immediately calls this.posts.refreshParams(this.params(user), 1) -> refresh(1) -> goto(1), which resets location to page 1 before any request is made. (location.page only feeds a request through getNextPageNumber() while no pages are loaded, and PostList's "load more" control is hidden until hasNext() is true, i.e. after a page has already loaded.)
pageSize stays null and is then populated from the server's meta.perPage on load. Since PostResource::$defaultLimit = 20, the effective page size ends up as 20 anyway.
So loadLimit currently has no runtime effect: the profile feed paginates at the server default, not because of loadLimit.
Why it is worth noting
It is a latent trap: bumping loadLimit (e.g. to 50) to make the profile load larger pages would silently do nothing. The sibling DiscussionsUserPage has no loadLimit at all and simply relies on the server default, which is the consistent pattern.
Suggested fix
Either:
- Remove the dead field and match
DiscussionsUserPage: this.posts = new PostListState({});, or
- Pass it in the correct position if a profile-specific size is actually wanted:
new PostListState({}, 1, this.loadLimit);
Both are behavior-preserving today, since loadLimit (20) equals the server default.
Found while investigating the page[limit] handling in #4775 / #4773. Low severity, no user-visible impact. I'll look into it further before proposing a change.
Summary
PostsUserPagebuilds itsPostListStatewith the intended per-request page size passed into the wrong constructor parameter, which makes theloadLimitfield dead code. It is currently harmless, but the code is misleading and is a latent trap.Details
framework/core/js/src/forum/components/PostsUserPage.tsx:PostListState's constructor signature (viaPaginatedListState) is(params, page = 1, pageSize = null). Sothis.loadLimit(20) is passed as thepageargument, notpageSize, even though the field is documented as the per-request item count.Current behavior
It happens to be inert today, for two reasons:
location = { page: 20 }, butshow()immediately callsthis.posts.refreshParams(this.params(user), 1)->refresh(1)->goto(1), which resetslocationto page 1 before any request is made. (location.pageonly feeds a request throughgetNextPageNumber()while no pages are loaded, andPostList's "load more" control is hidden untilhasNext()is true, i.e. after a page has already loaded.)pageSizestaysnulland is then populated from the server'smeta.perPageon load. SincePostResource::$defaultLimit = 20, the effective page size ends up as 20 anyway.So
loadLimitcurrently has no runtime effect: the profile feed paginates at the server default, not because ofloadLimit.Why it is worth noting
It is a latent trap: bumping
loadLimit(e.g. to 50) to make the profile load larger pages would silently do nothing. The siblingDiscussionsUserPagehas noloadLimitat all and simply relies on the server default, which is the consistent pattern.Suggested fix
Either:
DiscussionsUserPage:this.posts = new PostListState({});, ornew PostListState({}, 1, this.loadLimit);Both are behavior-preserving today, since
loadLimit(20) equals the server default.Found while investigating the
page[limit]handling in #4775 / #4773. Low severity, no user-visible impact. I'll look into it further before proposing a change.