[6.x] Improve Bard/Replicator performance during page load - #13427
Merged
Conversation
duncanmcclean
commented
Jan 5, 2026
| items: $replicatorSet['fields'], | ||
| parent: Data::find($request->reference), | ||
| parentField: $field, | ||
| parentIndex: -1 |
Member
Author
There was a problem hiding this comment.
Passing -1 here might be a little confusing, but according to this PR, it's the intended value when generating the new/defaults arrays.
duncanmcclean
marked this pull request as ready for review
January 6, 2026 14:53
# Conflicts: # resources/js/components/fieldtypes/bard/BardFieldtype.vue # resources/js/components/fieldtypes/replicator/Replicator.vue
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.
This pull request aims to improve the performance of Bard & Replicator fields during page load by reducing the payload we generate and send to the client.
This PR also reduces the likelihood of Firefox users running into this error.
Solution
Currently, when we preprocess Bard & Replicator fields, we return
newanddefaultsarrays, which carry the default values and metadata for new sets.By nature, we only ever need these values when you add a new set. If all you're doing is editing an existing entry, we're generating a bunch of data you don't actually need.
My "solution" is simple:
newanddefaultsfrom the fieldtype's metadataBenchmarks
I've tested this approach on a few real sites I've got access to - measuring the page load of the publish form.
Site 1
Before: 3.71s (1235kB)
After: 542ms (121kB)
Site 2
Before: 1.82s (4862kB)
After: 806ms (1672kB)
Related: #11993