Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

Year filter in ledger view was displaying transactions from all years even when a specific year was selected. Root cause: statement dividers for credit card accounts were created without respecting the year filter, causing year groups to be rendered for non-selected years.

Changes

  • LedgerTable.jsx: Added year filter check before processing statement dividers
    // Skip statement dividers that don't belong to the selected year
    if (selectedYear !== 'all') {
      const statementYear = format(closingDate, 'yyyy');
      if (statementYear !== selectedYear) {
        return;
      }
    }
  • Added selectedYear to groupedData useMemo dependency array
  • Created unit tests verifying year filter behavior for both transactions and statement dividers

Technical Context

The groupedData memo iterates through account statements to insert dividers. Previously, it processed all statements regardless of selectedYear, creating year groups in the grouped data structure even for filtered-out years. When rendered, Object.keys(groupedData) would include these unfiltered years.

The fix ensures statement dividers are only created for the selected year, preventing year groups from being added to groupedData for non-matching years.

Original prompt

This section details on the original issue you should resolve

<issue_title>Year Filter Not Working</issue_title>
<issue_description>When using the year filter at the top of the ledger view it does not filter the transactions correctly. Both previous and upcoming years are displayed.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Added year filter check for statement dividers in LedgerTable
- Statement dividers now only show for the selected year
- Added selectedYear to useMemo dependency array
- Created tests to verify year filtering logic

Co-authored-by: jwaspin <6432180+jwaspin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix year filter functionality in ledger view Fix year filter incorrectly showing transactions from all years Dec 16, 2025
Copilot AI requested a review from jwaspin December 16, 2025 02:07
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 19, 2025

Deploying lucaledger with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4e46991
Status: ✅  Deploy successful!
Preview URL: https://6bb3e5e7.lucaledger.pages.dev
Branch Preview URL: https://copilot-fix-year-filter-issu.lucaledger.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 19, 2025

Deploying beta-lucaledger with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4e46991
Status: ✅  Deploy successful!
Preview URL: https://54bffaea.beta-lucaledger.pages.dev
Branch Preview URL: https://copilot-fix-year-filter-issu.beta-lucaledger.pages.dev

View logs

@jwaspin jwaspin marked this pull request as ready for review December 19, 2025 20:01
@jwaspin jwaspin merged commit 651556f into main Dec 19, 2025
3 checks passed
@jwaspin jwaspin deleted the copilot/fix-year-filter-issue branch December 19, 2025 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Year Filter Not Working

2 participants