- Issue created by @catch
Routes that specify load_latest_revision - which content_moderation does for the node edit page and similar, load the latest revision even for access checks and similar, including for users that would never be able to reach the node edit form under any circumstances.
See @berdir's notes in 📌 ContentEntityStorageBase::loadRevision() should use the static and the persistent entity cache like ContentEntityStorageBase::load() Needs work and also 🐛 Entity queries querying the latest revision very slow with lots of revisions Needs work for some background.
There are two problems:
1. The query is very slow, much less slow after 🐛 Entity queries querying the latest revision very slow with lots of revisions Needs work but still not fast.
2. Per 📌 ContentEntityStorageBase::loadRevision() should use the static and the persistent entity cache like ContentEntityStorageBase::load() Needs work revision loads aren't static cached. This can result in dozens of database queries when multiple routes are set to use the latest revision.
If we want to keep the same behaviour in content moderation, it could take over the route itself, load the revision it needs when it's actually viewed and show that revision in the form. This would avoid loading the revision to check access on the edit tab when just viewing the node, which is the main performance issue.
Active
11.0 🔥
content_moderation.module
It affects performance. It is often combined with the Needs profiling tag.