fix(#1240): fix overall balance to stay anchored to today across calendar navigation#1350
Conversation
b774338 to
d533cdb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
…s calendar navigation
d533cdb to
a937a4e
Compare
|
@tupaschoal Please review this PR when you can and approve workflow if required, Thanks. |
|
Sorry for the delay, I'm currently very busy, so it will still be a couple weeks until I can review it |
tupaschoal
left a comment
There was a problem hiding this comment.
Hi @rbalogic, sorry it took me so long to review this, but I'm finally here :D
It looks to be working just fine and thanks for adding tests. Maybe we need an additional test with some actual values just to trust that the math is expected?
Also I noticed that when we switch months/days (depending on calendar view), the overall balance flickers as if it just recalculated, but now we know it doesn't, so there is probably logic somewhere that doesn't need to be called everytime the view changes.
| waitUntilHandlersSetup = new Promise(resolve => | ||
| { | ||
| window.__resolveCalendarHandlersSetup = resolve; | ||
| }); |
There was a problem hiding this comment.
Why did you have to add this piece of code?
There was a problem hiding this comment.
This was added to make the test deterministic.
src/calendar.js registers the IPC handlers during async setup after import, and in the full suite this test could sometimes assert before handleToggleMainWindowWait had been assigned. This small wait just synchronizes the test with that setup.
|
@tupaschoal I have addressed the comments. Added a real-value regression test, removed the redundant month-view overall balance refresh that was causing the extra recalculation, and explained the Please review when you can, Thanks. |
|
@tupaschoal Thanks, I handled this in the same PR. The remaining flicker was coming from the month view redraw recreating the So this should keep the field stable during navigation while preserving the existing async calculation flow. |
|
\changelog-update |


Summary
Fixes #1240.
Overall Balance now stays anchored to the real current day, even when navigating to past or future dates in Month/Day views.
What Changed?
count-todaybehaviorWhy This Change?
Navigating the calendar previously made Overall Balance appear to shift with the viewed date.
This update keeps the metric fixed to today for consistent, predictable behavior.
Testing
Notes