Skip to content

Commit 7c3934d

Browse files
fix: logic errors
1 parent 0fe1ce4 commit 7c3934d

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

js/Conditions/ConditionsControl.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ const SUPPORTED_FIELDS = [
5454
unsupportedOperators: ['greater_than', 'gte', 'less_than', 'lte'],
5555
},
5656
];
57+
const isPro = window.feedzyData.isPro;
5758

5859
const ConditionsControl = ({ conditions, setConditions }) => {
59-
const isPro = window.feedzyData.isPro;
6060
const onChangeMatch = (value) => {
6161
setConditions({
6262
...conditions,
@@ -88,11 +88,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
8888
});
8989
};
9090

91-
const onChangeCondtion = (index, value, key) => {
92-
if (!isPro) {
93-
return;
94-
}
95-
91+
const onChangeCondition = (index, value, key) => {
9692
const conditionsCopy = [...conditions.conditions];
9793

9894
conditionsCopy[index][key] = value;
@@ -130,10 +126,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
130126
value={conditions.match}
131127
options={[
132128
{
133-
label: __(
134-
'All conditions are met',
135-
'feedzy-rss-feeds'
136-
),
129+
label: __('All conditions are met', 'feedzy-rss-feeds'),
137130
value: 'all',
138131
},
139132
{
@@ -165,7 +158,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
165158
value={condition?.field}
166159
options={SUPPORTED_FIELDS}
167160
onChange={(value) =>
168-
onChangeCondtion(index, value, 'field')
161+
onChangeCondition(index, value, 'field')
169162
}
170163
disabled={!isPro}
171164
/>
@@ -190,7 +183,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
190183
}
191184
value={condition?.operator}
192185
onChange={(value) =>
193-
onChangeCondtion(index, value, 'operator')
186+
onChangeCondition(index, value, 'operator')
194187
}
195188
disabled={!isPro}
196189
/>
@@ -205,7 +198,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
205198
label={__('Value', 'feedzy-rss-feeds')}
206199
value={condition?.value}
207200
onChange={(value) =>
208-
onChangeCondtion(
201+
onChangeCondition(
209202
index,
210203
value,
211204
'value'
@@ -218,7 +211,7 @@ const ConditionsControl = ({ conditions, setConditions }) => {
218211
label={__('Value', 'feedzy-rss-feeds')}
219212
value={condition?.value}
220213
onChange={(value) =>
221-
onChangeCondtion(
214+
onChangeCondition(
222215
index,
223216
value,
224217
'value'

0 commit comments

Comments
 (0)