diff --git a/src/components/OptionListContextProvider.tsx b/src/components/OptionListContextProvider.tsx index 4eef9e93f188..4df741be448a 100644 --- a/src/components/OptionListContextProvider.tsx +++ b/src/components/OptionListContextProvider.tsx @@ -64,22 +64,11 @@ function OptionsListContextProvider({reports, children}: OptionsListProviderProp return; } - const lastUpdatedReport = ReportUtils.getLastUpdatedReport(); - - if (!lastUpdatedReport) { - return; - } - - const newOption = OptionsListUtils.createOptionFromReport(lastUpdatedReport, personalDetails); - const replaceIndex = options.reports.findIndex((option) => option.reportID === lastUpdatedReport.reportID); - - if (replaceIndex === -1) { - return; - } + const newReports = OptionsListUtils.createOptionList({}, reports).reports; setOptions((prevOptions) => { const newOptions = {...prevOptions}; - newOptions.reports[replaceIndex] = newOption; + newOptions.reports = newReports; return newOptions; }); // eslint-disable-next-line react-hooks/exhaustive-deps