Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Fix missing replicator set previews #8855

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Oct 16, 2023

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 replicator previews 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.

@jasonvarga jasonvarga merged commit e5665ac into statamic:4.x Oct 16, 2023
20 checks passed
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.

Replicator preview not showing text input field after save
2 participants