Skip to content

[6.x] Improve Bard/Replicator performance during page load - #13427

Merged
jasonvarga merged 22 commits into
masterfrom
replicator-meta
Jan 23, 2026
Merged

[6.x] Improve Bard/Replicator performance during page load#13427
jasonvarga merged 22 commits into
masterfrom
replicator-meta

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Jan 5, 2026

Copy link
Copy Markdown
Member

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 new and defaults arrays, 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:

  • Stop returning new and defaults from the fieldtype's metadata
  • Perform an AJAX request when you add a set to load it's default values and metadata
    • The values/meta will be cached in a Vue property in case you want to add the same set again, avoiding unnecessary requests.

Benchmarks

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

@duncanmcclean duncanmcclean changed the title [6.x] Only preProcess [6.x] Improve initial page load performance for Bard & Replicators Jan 5, 2026
@duncanmcclean duncanmcclean changed the title [6.x] Improve initial page load performance for Bard & Replicators [6.x] Improve Bard/Replicator performance during page load Jan 5, 2026
items: $replicatorSet['fields'],
parent: Data::find($request->reference),
parentField: $field,
parentIndex: -1

@duncanmcclean duncanmcclean Jan 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
duncanmcclean marked this pull request as ready for review January 6, 2026 14:53
@jasonvarga
jasonvarga merged commit 509a21f into master Jan 23, 2026
11 checks passed
@jasonvarga
jasonvarga deleted the replicator-meta branch January 23, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants