Pennywise

2 min read

Added Events planning and fixed tab-switch session reloads

Summary

Implemented and pushed the Events backend and responsive frontend, including sidebar navigation, itemized expected and incurred costs, lifecycle controls, duplication, soft deletion, optimistic concurrency, and current-month cash-flow suggestions. Verified PostgreSQL integration and migration up/down/up tests on a disposable database, fixed an older migration test’s version assumption, and passed backend race tests. Removed unconditional tab-visibility auth refresh and profile rehydration so unsaved event drafts survived tab switches while expired API tokens still refreshed on 401. The frontend build, 301 unit/component tests, and seven browser tests in a serial run passed; repository-wide lint retained existing errors.

Decisions

  • Kept event incurred costs, including unpaid bills, independent of Transactions and reused the existing free-money formula without reservations or allocations.
  • Used backend-computed totals and completeness, preserving null versus explicit zero and requiring actual costs for every item before completion.
  • Saved event metadata and ordered items atomically with version checks; soft-deleted events retained their children, while duplication reset actuals, date, and status.
  • Limited suggestions to eligible planned events in the current month using browser timezone context, with suggestions enabled by default.
  • Retained startup session restoration and API-401 refresh while eliminating unconditional auth requests on tab return and profile reloads for healthy cross-tab token rotations.

Learnings

  • Setting global authentication loading state during background profile hydration can unmount active forms and discard unsaved drafts.
  • Migration regression tests should target prerequisite versions explicitly rather than assume the latest migration is always the one under test.
  • Node experimental Web Storage can shadow jsdom storage; disabling it for the test process restored the browser-like test environment.