Repository navigation
[6.x] Only send the ids and types of replicator sets and grid rows to listings - #15811
Open
DanielDarrenJones wants to merge 1 commit into
Open
DanielDarrenJones wants to merge 1 commit into
DanielDarrenJones wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
When a replicator or grid column is shown in a listing (entries, terms, users, assets or form submissions), every row carries that field's whole value, nested sets and all. The listing cell only shows how many there are (
:count sets/:count rows), and it gets that by counting the array.This adds
preProcessIndex()to both fieldtypes:Replicatorkeeps each set'sid,typeandenabled.Gridkeeps each row'sid.The array still has one item per set or row, so the cell reads exactly the same. Bard has its own
preProcessIndex()and isn't affected.Benchmark
A generated site on 6.40.0 with an 85 KB page builder blueprint. Each request runs in its own PHP process, as PHP-FPM serves it (boot not timed, opcache on), median of 5, on an M1 Pro with PHP 8.5.
A 50-entry listing with the page builder column visible goes from 1.06 MB to 27 KB and from 80 ms to 66 ms.
I also checked the CP in a browser on stock 6.40.0 and with this change: the listing table renders identically, including a grid column with 3 to 8 rows per entry and a Bard column next to it.
Compatibility
An addon fieldtype that extends
ReplicatororGridand has its own index component showing the set or row contents would now only get those keys. It can overridepreProcessIndex()to keep the old behaviour. I couldn't find a public addon that does this.Tests
ViewEntryListingTest::it_only_lists_the_ids_and_types_of_replicator_sets_and_grid_rows(fails without the change).ReplicatorTestandGridTestcover what's kept, and that non-arrays andnullpass through.The full suite passes.