Skip to content

Commit d07b87e

Browse files
committed
sorting issue
1 parent 6d2598b commit d07b87e

File tree

1 file changed

+5
-2
lines changed
  • app/javascript/components/record-form/form/subforms/subform-field-array

1 file changed

+5
-2
lines changed

app/javascript/components/record-form/form/subforms/subform-field-array/component.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { GuidingQuestions } from "../../components";
1717
import ChildFunctioningSummary from "../../../../child-functioning-summary";
1818

1919
import { isEmptyOrAllDestroyed, isTracesSubform } from "./utils";
20+
import { sortBy } from "lodash";
2021

2122
function Component({
2223
arrayHelpers,
@@ -112,9 +113,11 @@ function Component({
112113
</div>
113114
);
114115

115-
const getlatestValue = arr => arr?.[0] ?? null;
116-
const latestValue = getlatestValue(orderedValues);
117116

117+
const sortedOrderValues = sortBy(orderedValues, ["date_cfm_start"]).reverse();
118+
const getlatestValue = arr => arr?.[0] ?? null;
119+
const latestValue = getlatestValue(sortedOrderValues);
120+
118121
return (
119122
<div className={css.fieldArray} data-testid="subform-field-array">
120123
{/* Conditionally Render Child Functioning Subform Summary */}

0 commit comments

Comments
 (0)