Skip to content

[2.x] fix: accept base Collection in LoadReactionCounts::forPosts#106

Merged
imorland merged 1 commit into2.xfrom
im/fix-load-reaction-counts-collection-type
Apr 3, 2026
Merged

[2.x] fix: accept base Collection in LoadReactionCounts::forPosts#106
imorland merged 1 commit into2.xfrom
im/fix-load-reaction-counts-collection-type

Conversation

@imorland
Copy link
Copy Markdown
Member

@imorland imorland commented Apr 3, 2026

Fixes a TypeError thrown on GET /api/discussions (load more) introduced by the N+1 batch-loading changes.

extend.php builds the posts collection via Collection::make(), which returns an Illuminate\Support\Collection. forPosts() was typed to Illuminate\Database\Eloquent\Collection, causing a fatal type error. Widening the type hint to the base Collection resolves this.

@imorland imorland requested a review from a team as a code owner April 3, 2026 09:10
@imorland imorland changed the title fix: accept base Collection in LoadReactionCounts::forPosts [2.x] fix: accept base Collection in LoadReactionCounts::forPosts Apr 3, 2026
@imorland imorland merged commit 25a9552 into 2.x Apr 3, 2026
20 checks passed
@imorland imorland deleted the im/fix-load-reaction-counts-collection-type branch April 3, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant