Skip to content

Commit

Permalink
Merge pull request #40730 from tienifr/fix/40406
Browse files Browse the repository at this point in the history
fix workspace list does not show
  • Loading branch information
thienlnam authored Apr 24, 2024
2 parents d8ed250 + 8f0fc1e commit 9a727de
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/components/OptionListContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,18 @@ function OptionsListContextProvider({reports, children}: OptionsListProviderProp
if (!areOptionsInitialized.current || !reports) {
return;
}
const missingReportId = Object.keys(reports).find((key) => prevReports && !(key in prevReports));
const report = missingReportId ? reports[missingReportId] : null;
if (!missingReportId || !report) {
return;
}
const missingReportIds = Object.keys(reports).filter((key) => prevReports && !(key in prevReports));

const reportOption = OptionsListUtils.createOptionFromReport(report, personalDetails);
setOptions((prevOptions) => {
const newOptions = {...prevOptions};
newOptions.reports.push(reportOption);
missingReportIds.forEach((missingReportId) => {
const report = missingReportId ? reports[missingReportId] : null;
if (!missingReportId || !report) {
return;
}
const reportOption = OptionsListUtils.createOptionFromReport(report, personalDetails);
newOptions.reports.push(reportOption);
});
return newOptions;
});
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit 9a727de

Please sign in to comment.