fix(reports): make the Uncategorized spending drill-down load its transactions - #141
Merged
Merged
Conversation
…nsactions Clicking Uncategorized on the Spending tab opened an empty sheet reading "No transactions found." Two bugs stacked on the same value: 1. DrillDownSheet fetched from an effect keyed on the filter's individual fields. With the sheet closed the filter is null, so every field reads undefined — and an uncategorized drill-down carried categoryId undefined too, making the open state field-for-field identical to the closed one. The effect never re-ran and rows stayed empty. Every real category has a non-undefined id, which is why only Uncategorized broke. Depend on the filter object itself instead; it is fresh state on each click. 2. The null categoryId was flattened to undefined twice on the way down (report-spending and the server action). getTransactions reads null as IS NULL but undefined as "no category filter", so once the fetch did fire it returned every transaction in the range rather than the uncategorized ones. Carry the null through. The footer link had the same hole — it dropped the category param for null, linking to all transactions. Extracted as drillDownTransactionsUrl, which emits the category=uncategorized sentinel the transactions page already parses, with unit tests over the three id states. The chart's rolled-up "Other" slice also carries id null, so with the null now meaningful it would have drilled into Uncategorized. It spans several categories, which drill-down cannot express, so it is flagged synthetic and inert on click; that flag also replaces the fragile id-and-name check used to pick its neutral color.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Clicking Uncategorized on
/reports(Spending tab) opened a drill-down sheet reading "No transactions found." Two bugs stacked on the same value.1. The fetch never fired
DrillDownSheetfetched from an effect keyed on the filter's individual fields:While the sheet is closed
filterisnull, so every one of those reads asundefined. An uncategorized drill-down carriedcategoryId: item.id ?? undefined, making the open state field-for-field identical to the closed state — nothing in the deps changed, the effect never re-ran, androwsstayed[].Every real category has a non-undefined id, which is why only Uncategorized broke, and why it appeared to work if you opened a real category first (
"abc" → undefinedis a change).Now depends on the
filterobject itself, which is fresh state on each click.2. Even once it fired, it queried the wrong thing
The
nullcategoryId was flattened toundefinedtwice on the way down — inreport-spending.tsxand again inactions/reports.ts.getTransactionsreadsnullasIS NULLbutundefinedas no category filter at all (queries/transactions.ts:106-109), so the sheet would have listed every transaction in the range. Thenullis now carried through.Also fixed
null, linking to all transactions. Extracted asdrillDownTransactionsUrl, which emits thecategory=uncategorizedsentinelparse-transaction-filters.tsalready understands. Unit tests cover the three id states plus month narrowing.id: null, so with the null now meaningful it would have drilled into Uncategorized. It spans several categories, which drill-down can't express, so it's flaggedsyntheticand inert on click — that flag also replaces the fragileid === null && name === "Other"check used to pick its neutral color.Cash Flow and Income vs Expense drill-downs are unaffected: both queries exclude null categories (
isNotNull(transactions.categoryId)), so neither can produce an uncategorized row.Verification
pnpm typecheck,pnpm lintclean🤖 Generated with Claude Code