mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(folio): make ledgerRowsSeen monotonic to suppress transient-render false positives
This commit is contained in:
1 parent
aa42b8e504
commit
3d67e5e3b6
1 file changed
+9
-8
@@ -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(
|
||||||
|
|||||||
Reference in new issue
Block a user