Skip to content

Commit

Permalink
Fixes issue with the sector dropdown not being populated on update.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorylavery committed Sep 26, 2024
1 parent fa5b709 commit d0407d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ export const DecisionForm: FC<props> = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [officerAssigned]);

useEffect(() => {
if (sector && schedule) {
let options = scheduleSectorType.filter((item) => item.schedule === schedule).map(item => {
const record: Option = { label: item.longDescription, value: item.sector };
return record
});
const model = { ...data, sector: sector, schedule: schedule };
setData(model);
setSectorList(options);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [officerAssigned]);
//-- update the decision state by property
const updateModel = (property: string, value: string | Date | undefined) => {
const model = { ...data, [property]: value };
Expand Down
1 change: 0 additions & 1 deletion frontend/src/app/store/reducers/code-table-selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const selectScheduleSectorDropdown = (state: RootState): Array<Option> =>
const {
codeTables: { sector: items, "schedule-sector": scheduleSector },
} = state;
let _scheduleSector = scheduleSector;
const data = items.map(({ sector: value, longDescription: label }) => {
return { label, value };
});
Expand Down

0 comments on commit d0407d3

Please sign in to comment.