Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/js/components/field-conditions/Validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,6 @@ export default class {
return false;
}

return intersection(this.getCheckedFieldPaths(dottedPrefix), revealerFields).length;
return intersection(this.getCheckedFieldPaths(dottedPrefix), revealerFields).length > 0;
}
}
16 changes: 11 additions & 5 deletions resources/js/components/field-conditions/ValidatorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down