Add a durable, acknowledged Local network sharing switch with fail-closed hydration, serialized mutation, and redacted ephemeral-identity diagnostics. Keep local Call-to-Play state available while gating every network action on the effective sharing generation. Render revisioned verification, invalid-source retry, and sticky source exhaustion states. Preserve opaque attempt IDs through progress delivery so out-of-order webview events cannot attach stale bytes to a successor transfer, and keep terminal exhaustion visible after the last source departs. Own listeners, native invokes, persistence, dialogs, and companion-window creation through webview close. Late creation is settled and cleaned before the parent realm is destroyed. Test Plan: - `just frontend-test` -- passed (91/91) - `just build` -- passed with TypeScript, Vite, and release Tauri compilation - `just test` -- passed on the completed stack (708 workspace tests) - `just clippy` -- passed on the completed stack - `git diff --cached --check` -- passed
19 lines
568 B
TypeScript
19 lines
568 B
TypeScript
import { type ProtocolMismatch } from "./types";
|
|
|
|
export interface ProtocolMismatchSnapshot {
|
|
revision: number;
|
|
mismatch: ProtocolMismatch | null;
|
|
}
|
|
|
|
export const INITIAL_PROTOCOL_MISMATCH_SNAPSHOT: ProtocolMismatchSnapshot = {
|
|
revision: 0,
|
|
mismatch: null,
|
|
};
|
|
|
|
/** Keeps listener events and bootstrap queries monotonic across async races. */
|
|
export const newestProtocolMismatchSnapshot = (
|
|
current: ProtocolMismatchSnapshot,
|
|
candidate: ProtocolMismatchSnapshot,
|
|
): ProtocolMismatchSnapshot =>
|
|
candidate.revision > current.revision ? candidate : current;
|