Skip to content

Commit 9128dc7

Browse files
dannyuk1982claude
andauthored
[6.x] Fix replicator preview text merging during reorder (#14072)
Fix replicator preview text merging fields from different set types during reorder When drag-and-drop reordering replicator sets of different types, the collapsed preview text incorrectly merged fields from multiple set types. This happened because stale preview entries from the old set type remained at index-based paths, and the previewText filter failed to exclude fields that don't belong to the current set type — when a field handle wasn't found in the set's config, it fell back to {} and {}.replicator_preview === undefined evaluated to true, letting foreign fields pass through. Now when a field handle is not found in the current set's config, it returns false immediately, filtering out any stale foreign-type fields. Fixes #14071 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 27f94d7 commit 9128dc7

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

resources/js/components/fieldtypes/replicator/ManagesPreviewText.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ export default {
77
.filter(([handle, value]) => {
88
if (!handle.endsWith('_')) return false;
99
handle = handle.substr(0, handle.length - 1); // Remove the trailing underscore.
10-
const config = this.config.fields.find((f) => f.handle === handle) || {};
10+
const config = this.config.fields.find((f) => f.handle === handle);
11+
if (!config) return false;
1112
return config.replicator_preview === undefined ? this.showFieldPreviews : config.replicator_preview;
1213
})
1314
.map(([handle, value]) => value)

resources/js/components/fieldtypes/replicator/Set.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ const previewText = computed(() => {
8383
.filter(([handle, value]) => {
8484
if (!handle.endsWith('_')) return false;
8585
handle = handle.substr(0, handle.length - 1); // Remove the trailing underscore.
86-
const config = props.config.fields.find((f) => f.handle === handle) || {};
86+
const config = props.config.fields.find((f) => f.handle === handle);
87+
if (!config) return false;
8788
return config.replicator_preview === undefined ? props.showFieldPreviews : config.replicator_preview;
8889
})
8990
.map(([handle, value]) => value)

0 commit comments

Comments
 (0)