Skip to content

Commit b87d4cf

Browse files
authored
PRO-7997: Fix conditional fields BC break (hidden when it depends on a hidden) (#4996)
* Fix BC break - hidden when depends on a hidden
1 parent da2f3e6 commit b87d4cf

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
* Add missing Pages manager shortcuts list helper.
1717
* Improve the `isEmpty` method of the rich text widget to take into account the HTML blocks (`<figure>` and `<table>`) that are not empty but do not contain any plain text.
18+
* (Backward compatibility break) Conditional field that depends on already hidden field is also hidden, again.
1819

1920
## 4.18.0 (2025-06-11)
2021

modules/@apostrophecms/schema/ui/apos/lib/conditionalFields.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export function getConditionalFields(
124124
values,
125125
field[conditionType],
126126
(propName, condition, docValue) =>
127-
evaluateExternal(propName, condition, conditionType)
127+
evaluateExternalAndHidden(propName, condition, conditionType)
128128
);
129129
}
130130
}
@@ -134,10 +134,14 @@ export function getConditionalFields(
134134

135135
// Handle external conditions as a voter function.
136136
// Non-boolean returns are ignored by the `checkIfConditions` function.
137-
function evaluateExternal(propName, conditionValue, conditionType) {
137+
function evaluateExternalAndHidden(propName, conditionValue, conditionType) {
138138
if (isExternalCondition(propName, conditionType)) {
139139
return externalConditionsResults[conditionType]?.[propName] === conditionValue;
140140
}
141+
142+
if (result[conditionType]?.[propName] === false) {
143+
return false;
144+
}
141145
}
142146
}
143147

0 commit comments

Comments
 (0)