[4.x] Fix missing replicator set previews #8855
Merged
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.
Fixes #8839
The reason for this issue is that replicator passes the previews down to each set as a prop, but when the page loads and all fields trigger an update the prop isn't updated fast enough and each subsequent update wipes out the previews from the previous ones. The old
setTimeout
approach that the referenced PR changed avoided this.The issue isn't specific to text fields, it could happen for any field, it's just that the last field to initialise would always win and text fields are so simple they usually initialise first. I replicated the same issue with toggle fields, and text fields that are last in the set.
This PR fixes it by storing a copy of the previews in the set component, so that it always has a complete set rather than relying on the prop value. I did try setting
immediate: true
on the replicatorpreviews
watcher as an alternative fix, but that didn't seem to work.Theoretically this issue would apply to bard as well, however it doesn't because bard sets fetch their previews directly from the parent component's meta values, rather than relying on a prop being passed in.