Skip to content

Commit

Permalink
Fix report filter reporting stale Redux data (LF-3958)
Browse files Browse the repository at this point in the history
  • Loading branch information
kathyavini committed Mar 7, 2025
1 parent a5f8a30 commit a032055
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/webapp/src/containers/Finances/Report/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ const Report = () => {
revenueTypeFilter: typesFilter?.[REVENUE_TYPE],
});

// If dashboard filters change, update report filters
useEffect(() => {
// Refresh report filters according to current dashboard filters when opening modal
const openExportReport = () => {
setDateFilter(dashboardDateFilter);
}, [dashboardDateFilter]);

useEffect(() => {
setTypesFilter(dashboardTypesFilter);
}, [dashboardTypesFilter]);
setIsExportReportOpen(true);
};

const onValidityChange = (isValid) => {
setIsButtonDisabled(!isValid);
Expand Down Expand Up @@ -176,7 +174,7 @@ const Report = () => {

return (
<div>
<TextButton onClick={() => setIsExportReportOpen(true)} className={styles.reportButton}>
<TextButton onClick={openExportReport} className={styles.reportButton}>
<ReportIcon />
{t('SALE.FINANCES.REPORT')}
</TextButton>
Expand Down

0 comments on commit a032055

Please # to comment.