fix(folio): make ledgerRowsSeen monotonic to suppress transient-render false positives

This commit is contained in:
pj committed 2026-05-30 16:01:16 +05:30
1 parent aa42b8e504
commit 3d67e5e3b6
1 file changed
+9 -8
+9 -8
View File
@@ -100,18 +100,19 @@ const newAccountBalanceIsZero = always(
); );
// Property 2: no single user action grows the ledger by more than one row. // Property 2: no single user action grows the ledger by more than one row.
// The ledger is only observable on LedgerScreen, so carry the last seen count // The ledger is only observable on LedgerScreen, so carry the largest count
// across non-ledger steps. Otherwise a plain home -> ledger navigation would // ever seen forward. Folio has no delete-transaction; the row count never
// look like a delta of N from 0 and false-trigger the property. // legitimately shrinks, so transient renders that show 0 (newly-navigated,
// pre-layout) or N-1 (partial repaint) get suppressed and only true growth
// drives the comparison.
const ledgerRowsSeen = extract<number>((s): number => { const ledgerRowsSeen = extract<number>((s): number => {
// Only refresh when the ledger screen owns the foreground; transitional const prev = ledgerRowsSeen.previous ?? 0;
// states (AddTransaction overlay during navigation) hide LedgerRow nodes
// and would falsely zero the count.
const onLedgerOnly = const onLedgerOnly =
s.ax.find({ testTag: "LedgerScreen" }) != null && s.ax.find({ testTag: "LedgerScreen" }) != null &&
s.ax.find({ testTag: "AddTransactionScreen" }) == null; s.ax.find({ testTag: "AddTransactionScreen" }) == null;
if (!onLedgerOnly) return ledgerRowsSeen.previous ?? 0; if (!onLedgerOnly) return prev;
return s.ax.findAll([{ testTag: "LedgerScreen" }, { testTag: "LedgerRow" }]).length; const cur = s.ax.findAll([{ testTag: "LedgerScreen" }, { testTag: "LedgerRow" }]).length;
return cur > prev ? cur : prev;
}); });
const noDuplicateTxnPerStep = always( const noDuplicateTxnPerStep = always(