foldkit-remote/maintained: a value over the rows of a loaded list (a
total, a minimum, the rows themselves) kept up to date from the rows that
changed rather than worked out from all of them again (#580).
Live reverse-indexed view of grouped rows: forTarget reads the maintained
ReverseIndex for the latest Maintained.value read, so callers should not
retain old JoinedRows references as historical point-in-time snapshots.
The counted rows in the loaded connection's order. where picks which rows count.
The array is the same object while no row of it changed, and each row is
the same object while its fields are, so a view over one row is not drawn
again when another changes.
A maintained value over every row the client has loaded for the list's
query and input, as filtered is: not the rows that exist, and not the
window the read given as over shows (a read asking first: 25 of a list
holding 50 rows shows 25; the value is over the 50).
complete is filtered's. It is false when a loaded row could not be
judged by where, when a counted row lacks a field the list selects, when
the server has not said the loaded rows reach the start and the end, or
when a gap lies between loaded pages; the value is then over the rows that
could be counted.
Define a maintained fold over a custom @doeixd/metakit/operation commutative monoid.
Refuses at definition time if op does not claim commutative: true,
associative: true, and an identity.
A value over the rows of a loaded list, decoded as the list decodes them:
the rows where matches, or every row without it. Pass a definition made
once at module scope to keep its value between reads.
The value is kept between calls and changed by the rows that changed since
the last: a row written, a pending write shown or rolled back, a row
entering or leaving where. A live echo of a pending write changes nothing
shown, so it changes nothing kept. sum and count update the total
from each change and recompute if an intermediate total overflows.
every and any keep a count of the rows holding. min and max
fold a row in, and read the counted rows again only when the row holding
the extreme leaves or loses it. What cannot be traced to writes (a hydrated
snapshot, a change of who is viewing, any store change when where or the
Selection reads other rows) reads every row again and compares each with
what was kept. A change to the list itself (a page merged, a refetch) or a
pending write over it compares the list's keys, and judges only rows not
judged before.
Asks the server nothing and creates no connection: complete says whether
the answer is about the whole list.