Skip to content

Commit 2fc484e

Browse files
authored
Merge pull request #166 from don-aot/CONDITIONS-task#152
CR-152:Issue with “Time associated with submission milestone” Attribute
2 parents 588ae25 + b7a238f commit 2fc484e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

condition-web/src/components/ConditionDetails/ConditionAttribute/DynamicFieldRenderer.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,19 @@ const DynamicFieldRenderer: React.FC<DynamicFieldRendererProps> = ({
154154
}
155155
}, [attributeData.key, attributeData.value]);
156156

157+
const { setValue } = attributeData;
157158
useEffect(() => {
158159
if (timeUnit) {
159160
if (timeUnit === "N/A") {
160-
attributeData.setValue(timeUnit); // Only set the time unit
161+
setValue(timeUnit); // Only set the time unit
161162
} else {
162163
const value = customTimeValue || timeValue;
163-
if (value) {
164-
attributeData.setValue(`${value} ${timeUnit} ${timeDirection}`);
164+
if (value && timeDirection) {
165+
setValue(`${value} ${timeUnit} ${timeDirection}`);
165166
}
166167
}
167168
}
168-
}, [timeValue, timeUnit, timeDirection, customTimeValue, attributeData]);
169-
169+
}, [timeValue, timeUnit, timeDirection, customTimeValue, setValue]);
170170
const handleTimeUnitChange = (e: SelectChangeEvent<string>) => {
171171
const selectedUnit = e.target.value;
172172
setTimeUnit(selectedUnit);

0 commit comments

Comments
 (0)