Review preloading of hook payloads
This issue is part of the epic &8909 (closed). See that epic for more context.
Problem
We're optimising the triggering and execution of web hooks in &8974 (closed), but I'm unclear whether the payloads themselves are optimised or whether they suffer from N+1 data loading problems, or perhaps even indexing problems.
This issue is to capture the thought that we should at least investigate them.
Proposal
We should review whether webhook payload data loading could be optimised. It may be that nothing is wrong.
If any optimisation needs to be done, the issues could be given to the engineering teams that are most closely aligned with the hook type. We could hint at optimisations like using ActiveRecord::Associations::Preloader.
Consider adding a shared examples to enforce limit on number of queries made when building payloads (used in a similar way to the test for idempotent jobs).