From fa563ddb1fc5e6d3e77abe55d11303b5bd080979 Mon Sep 17 00:00:00 2001 From: Brent Hagen Date: Thu, 16 May 2024 14:46:41 -0400 Subject: [PATCH] initialize selected wells to reducer source wells value --- app/src/organisms/QuickTransferFlow/SelectSourceWells.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/organisms/QuickTransferFlow/SelectSourceWells.tsx b/app/src/organisms/QuickTransferFlow/SelectSourceWells.tsx index 9eee7a7806d..a9e76dd6a8a 100644 --- a/app/src/organisms/QuickTransferFlow/SelectSourceWells.tsx +++ b/app/src/organisms/QuickTransferFlow/SelectSourceWells.tsx @@ -24,7 +24,12 @@ export function SelectSourceWells(props: SelectSourceWellsProps): JSX.Element { const { onNext, onBack, state, dispatch } = props const { i18n, t } = useTranslation(['quick_transfer', 'shared']) - const [selectedWells, setSelectedWells] = React.useState({}) + const sourceWells = state.sourceWells ?? [] + const sourceWellGroup = sourceWells.reduce((acc, well) => { + return { ...acc, [well]: null } + }, {}) + + const [selectedWells, setSelectedWells] = React.useState(sourceWellGroup) const handleClickNext = (): void => { dispatch({