Skip to content

fix: stabilize preview transaction dates in settings#711

Merged
sadespresso merged 1 commit intoflow-mn:developfrom
PawiX25:fix/preview-transaction-random-dates
Apr 21, 2026
Merged

fix: stabilize preview transaction dates in settings#711
sadespresso merged 1 commit intoflow-mn:developfrom
PawiX25:fix/preview-transaction-random-dates

Conversation

@PawiX25
Copy link
Copy Markdown
Contributor

@PawiX25 PawiX25 commented Apr 20, 2026

Summary

Fixes preview transaction dates randomly changing every time a setting is toggled in the list tile appearance preferences.

Problem

getExampleTransactions() was called inside build() and used Random().nextInt(1000) (unseeded). Every setState() triggered by toggling a switch would regenerate the example transactions with new random dates, causing the preview times to visibly jump.

Changes

  • Moved example transaction generation to didChangeDependencies() (needs context for the category name localization)
  • Stored transactions in a late final field so they're created once per page visit
  • Used Random(42) (fixed seed) for deterministic preview dates
  • Removed dead commented-out code at the end of the file

Fixes #709

Move example transaction generation to `didChangeDependencies()` so
they're created once and reused across rebuilds. Use `Random(42)` with
a fixed seed to produce deterministic dates.

Previously, toggling any setting called `setState()` which regenerated
the preview transactions with new random dates, causing the displayed
times to jump.

Fixes flow-mn#709
@PawiX25 PawiX25 force-pushed the fix/preview-transaction-random-dates branch from 3c85d0e to 0236c1d Compare April 20, 2026 00:49
Copy link
Copy Markdown
Collaborator

@sadespresso sadespresso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sadespresso sadespresso merged commit a4d1286 into flow-mn:develop Apr 21, 2026
1 of 2 checks passed
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.

bug: preview transaction dates randomize on every settings toggle

2 participants