feat(sp25): extend useTailStream dispatch for acks + ta1_acks

The Acks page mounts two streams (useTailStream("acks") and
useTailStream("ta1_acks")) — the dispatcher now routes their item
events into the matching store slices (addAck / addTa1Ack) the same
way the claims / remittances / activity cases already do.

Two new tests assert that an acks item lands in the acks slice (not
in claims) and a ta1_acks item lands in the ta1Acks slice (not in
acks) — i.e. the routing is exclusive, so a payload keyed by id 7
won't bleed across the two ack tables.
This commit is contained in:
Nora
2026-07-02 09:08:46 -06:00
parent 1648c81425
commit 029623f3a5
2 changed files with 99 additions and 2 deletions
+12 -1
View File
@@ -27,7 +27,7 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { streamTail, type TailResource } from "@/lib/tail-stream";
import { useTailStore } from "@/store/tail-store";
import type { Activity, Claim, Remittance } from "@/types";
import type { Ack, Activity, Claim, Remittance, Ta1Ack } from "@/types";
export type TailStatus =
| "connecting"
@@ -74,6 +74,17 @@ function dispatch(resource: TailResource, data: unknown): void {
case "activity":
store.addActivity(data as Activity);
break;
// SP25: the Acks page opens two streams — one per ack flavor —
// and the live event payloads are the same shape as the list
// endpoint (to_ui_ack / to_ui_ta1_ack in store/ui.py). The first
// write wins, so a snapshot replay on reconnect won't trample
// the canonical row.
case "acks":
store.addAck(data as Ack);
break;
case "ta1_acks":
store.addTa1Ack(data as Ta1Ack);
break;
}
}