[PR #6538] Fix null context crash in tracking budget mode #6587

Closed
opened 2026-02-28 21:30:22 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6538

State: closed
Merged: Yes


Plan to Fix Fatal Error on Budget Home Page

Root Cause

The TrackingBudgetContext was initialized with null instead of default values. When components tried to destructure currentMonth and other properties from useTrackingBudget(), it failed with "Cannot destructure property 'currentMonth' as it is null."

Minimal Changes Required

  • Fix TrackingBudgetContext.tsx to use proper default values instead of null (matching the pattern in EnvelopeBudgetContext.tsx)
  • Add TypeScript type definition for the context
  • Run type checking to ensure no breaking changes
  • Run linting to ensure code style compliance
  • Run unit tests to verify no regressions
  • Run code review for quality checks
  • Run CodeQL security analysis
  • Add release notes file (6538.md)

Validation Results

  • TypeScript type checking passed
  • ESLint passed with no errors
  • All unit tests passed (189 tests)
  • Code review completed (noted spelling is consistent with codebase)
  • CodeQL security analysis passed with 0 alerts
  • Release notes added

Security Summary

No security vulnerabilities were introduced or discovered during this change.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: Fatal error when loading Actual Budget home page</issue_title>
<issue_description>### Verified issue does not already exist?

  • I have searched and found no existing issue

What happened?

I upgraded to the latest version of ActualBudget (using docker compose) and when I go to the app I'm shown a Fatal Error:

TypeError: Cannot destructure property 'currentMonth' of 'Kmn(...)' as it is null. at Ymn (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:233:59779) at J_ (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:49009) at bR (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:71991) at ZG (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:82524) at Aq (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:118654) at a_e

How can we reproduce the issue?

Pull latest docker image and load ActualBudget.

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Chrome

Operating System

Mac OSX</issue_description>

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

@matt-fidd Are you able to replicate this on https://edge.actualbudget.com by uploading your budget file? @matt-fidd Can you try switching budget types through the settings page?

Image</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

**Original Pull Request:** https://github.com/actualbudget/actual/pull/6538 **State:** closed **Merged:** Yes --- ## Plan to Fix Fatal Error on Budget Home Page ### Root Cause The `TrackingBudgetContext` was initialized with `null` instead of default values. When components tried to destructure `currentMonth` and other properties from `useTrackingBudget()`, it failed with "Cannot destructure property 'currentMonth' as it is null." ### Minimal Changes Required - [x] Fix `TrackingBudgetContext.tsx` to use proper default values instead of `null` (matching the pattern in `EnvelopeBudgetContext.tsx`) - [x] Add TypeScript type definition for the context - [x] Run type checking to ensure no breaking changes - [x] Run linting to ensure code style compliance - [x] Run unit tests to verify no regressions - [x] Run code review for quality checks - [x] Run CodeQL security analysis - [x] Add release notes file (6538.md) ### Validation Results - ✅ TypeScript type checking passed - ✅ ESLint passed with no errors - ✅ All unit tests passed (189 tests) - ✅ Code review completed (noted spelling is consistent with codebase) - ✅ CodeQL security analysis passed with 0 alerts - ✅ Release notes added ### Security Summary No security vulnerabilities were introduced or discovered during this change. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>[Bug]: Fatal error when loading Actual Budget home page</issue_title> > <issue_description>### Verified issue does not already exist? > > - [x] I have searched and found no existing issue > > ### What happened? > > I upgraded to the latest version of ActualBudget (using docker compose) and when I go to the app I'm shown a Fatal Error: > > ``` > TypeError: Cannot destructure property 'currentMonth' of 'Kmn(...)' as it is null. at Ymn (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:233:59779) at J_ (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:49009) at bR (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:71991) at ZG (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:82524) at Aq (https://budget.[redacted].com/static/js/index.CO-yN_1L.js:9:118654) at a_e > ``` > > ### How can we reproduce the issue? > > Pull latest docker image and load ActualBudget. > > ### Where are you hosting Actual? > > Docker > > ### What browsers are you seeing the problem on? > > Chrome > > ### Operating System > > Mac OSX</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@matt-fidd</author><body> > Are you able to replicate this on https://edge.actualbudget.com by uploading your budget file?</body></comment_new> > <comment_new><author>@matt-fidd</author><body> > Can you try switching budget types through the settings page? > > <img width="552" height="260" alt="Image" src="https://github.com/user-attachments/assets/0577cad8-e40b-4ed1-9973-019faaf8b429" /></body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes actualbudget/actual#6293 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.
GiteaMirror added the pull-request label 2026-02-28 21:30:22 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6587