admin: live ring capacity is injectable, eviction test no longer timing-bound

This commit is contained in:
2026-08-23 09:04:18 +02:00
parent 1f215ac623
commit fe5bd967ca
3 changed files with 82 additions and 19 deletions
+15 -5
View File
@@ -276,8 +276,19 @@ function LiveDetail({ row, origin, onClose }: { row: StreamedRow; origin: Activi
);
}
export default function LiveActivity({ origin }: { origin: ActivitySearch }) {
const live = useLiveQueries();
/**
* `capacity` is the ring size, a parameter only so a test can provoke an
* eviction with a handful of rows rather than 500 frames through React state.
* The route renders this without it, so the app is always the 500-row ring.
*/
export default function LiveActivity({
origin,
capacity = RING_CAPACITY,
}: {
origin: ActivitySearch;
capacity?: number;
}) {
const live = useLiveQueries({ capacity });
const clientNames = useClientNames();
const [selected, setSelected] = useState<StreamedRow | null>(null);
const trigger = useRef<HTMLButtonElement | null>(null);
@@ -312,8 +323,7 @@ export default function LiveActivity({ origin }: { origin: ActivitySearch }) {
{live.frozen && (
<p {...stylex.props(styles.note)} role="status">
Display frozen new queries keep buffering ({live.liveCount} in buffer, newest {RING_CAPACITY}{" "}
kept).
Display frozen new queries keep buffering ({live.liveCount} in buffer, newest {capacity} kept).
</p>
)}
@@ -413,7 +423,7 @@ export default function LiveActivity({ origin }: { origin: ActivitySearch }) {
</div>
<p {...stylex.props(styles.footnote)}>
Showing {live.rows.length} {live.rows.length === 1 ? "query" : "queries"} (newest first, last{" "}
{RING_CAPACITY} kept).
{capacity} kept).
</p>
</>
)}