[2.x] perf(core): mitigate n+1 on notifications index#4817
Closed
DavideIadeluca wants to merge 1 commit into
Closed
[2.x] perf(core): mitigate n+1 on notifications index#4817DavideIadeluca wants to merge 1 commit into
DavideIadeluca wants to merge 1 commit into
Conversation
DavideIadeluca
marked this pull request as ready for review
July 16, 2026 14:22
This was referenced Jul 23, 2026
Member
imorland
added a commit
that referenced
this pull request
Jul 23, 2026
… n+1 (#4828) Gate the `subject.discussion` default include on whether a subject type actually exposes a `discussion` relationship, instead of on the number of subject types. The old count-based check added an invalid include when the extra types had no such relationship (e.g. a User-subject notification with no Post-subject type present), which the include validator rejected with a 400 for every request, breaking the notifications dropdown and page. Also eager-load the polymorphic subject's `state` / `discussion.state` so the index no longer issues a query per notification for them. Combines #4816 and #4817.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #0000
Changes proposed in this pull request:
Reviewers should focus on:
Review this along side #4816. Maybe take inspiration from both PR's and create a new PR yourself with a mixture of both fixes and close ours
Screenshot
Necessity
Confirmed
composer test).Required changes: