From 4d2a05a76290425417b84ce198cdf97e38d515cd Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Tue, 10 May 2022 17:09:56 -0400 Subject: [PATCH 1/2] Output explicit boolean here. --- resources/js/components/field-conditions/Validator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/js/components/field-conditions/Validator.js b/resources/js/components/field-conditions/Validator.js index 7850dec8ef8..ce839ea1130 100644 --- a/resources/js/components/field-conditions/Validator.js +++ b/resources/js/components/field-conditions/Validator.js @@ -294,6 +294,6 @@ export default class { return false; } - return intersection(this.getCheckedFieldPaths(dottedPrefix), revealerFields).length; + return intersection(this.getCheckedFieldPaths(dottedPrefix), revealerFields).length > 0; } } From 390b8cba0377c534b25bd952efeedb2c1d92b419 Mon Sep 17 00:00:00 2001 From: Jesse Leite Date: Tue, 10 May 2022 17:12:37 -0400 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20with=20$nextTick,=20but=20this=20does?= =?UTF-8?q?n=E2=80=99t=20feel=20like=20the=20best=20fix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../field-conditions/ValidatorMixin.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/resources/js/components/field-conditions/ValidatorMixin.js b/resources/js/components/field-conditions/ValidatorMixin.js index 29170978883..a9f6db7a570 100644 --- a/resources/js/components/field-conditions/ValidatorMixin.js +++ b/resources/js/components/field-conditions/ValidatorMixin.js @@ -15,12 +15,18 @@ export default { let validator = new Validator(field, this.values, this.$store, this.storeName); let passes = validator.passesConditions(); - let hiddenByRevealerField = validator.hasRevealerCondition(dottedPrefix); - this.$store.commit(`publish/${this.storeName}/setHiddenField`, { - dottedKey: dottedKey || field.handle, - hidden: ! passes, - omitValue: ! hiddenByRevealerField, + // TODO: The next tick here is necessary to fix #6018, but not sure it's the _right_ fix. + // Something is loading differently, causing the below `hiddenByRevealerField` check + // to fail, when the replicator is configured to collapse all sets by default 🤔 + this.$nextTick(() => { + let hiddenByRevealerField = validator.hasRevealerCondition(dottedPrefix); + + this.$store.commit(`publish/${this.storeName}/setHiddenField`, { + dottedKey: dottedKey || field.handle, + hidden: ! passes, + omitValue: ! hiddenByRevealerField, + }); }); return passes;