Draft
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3658 +/- ##
==========================================
+ Coverage 97.48% 97.50% +0.02%
==========================================
Files 314 315 +1
Lines 8272 8344 +72
==========================================
+ Hits 8064 8136 +72
Misses 208 208 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4c6f520 to
476cc5d
Compare
Introduce a new service that preloads element trees efficiently, eliminating N+1 queries for nested elements at any depth. Add alchemy_element_preloads hook to RelatableResource concern. Batch load picture descriptions in Picture This eliminates N+1 queries when loading picture descriptions in the element editor. The generic preloading mechanism allows any related object to define custom preloading by implementing alchemy_element_preloads.
Replace recursive N+1 query pattern with single-query
When all_nested_elements is already loaded (via ElementTreePreloader), use the preloaded data instead of querying the database. This avoids N+1 queries when re-initializing TinyMCE editors in the element editor.
When rendering element editors, each picture's thumbnail_url was triggering an individual query to find the thumb by signature. Now thumbs are preloaded in batch via the ElementTreePreloader's call to Picture.preload_for_element_editor.
476cc5d to
07eec5a
Compare
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.
What is this pull request for?
Introduce a new service that preloads element trees efficiently,
eliminating N+1 queries for nested elements at any depth.
Add
alchemy_element_preloadshook toRelatableResourceconcern.Batch load picture descriptions in Picture
This eliminates N+1 queries when loading picture descriptions in the
element editor. The generic preloading mechanism allows any related
object to define custom preloading by implementing
alchemy_element_preloads.Checklist