From 5c76e12142359a06d89ba5748f4b8a7cccd9ef9a Mon Sep 17 00:00:00 2001 From: MDietermann Date: Fri, 14 Aug 2026 18:19:18 +0200 Subject: [PATCH] chore(prototype): state-model prototype for the realtime frontend Throwaway, kept as a primary source rather than on main. Single self-contained HTML file: free-play buttons plus six guided walkthroughs over a pure reducer. It settled two things the spec had wrong or missing: - The client must supply the message id. With a server-generated id there is nothing to reconcile the optimistically rendered message against when it comes back over the realtime channel, and it renders twice. Both cases are reproducible via the toggle at the top. - An unread *count* cannot be derived without fetching, because seq counts events and not messages. Hence: fetch for DMs, a plain dot for channels. --- PROTOTYPE-frontend-zustandsmodell.html | 493 +++++++++++++++++++++++++ 1 file changed, 493 insertions(+) create mode 100644 PROTOTYPE-frontend-zustandsmodell.html diff --git a/PROTOTYPE-frontend-zustandsmodell.html b/PROTOTYPE-frontend-zustandsmodell.html new file mode 100644 index 0000000..4f53115 --- /dev/null +++ b/PROTOTYPE-frontend-zustandsmodell.html @@ -0,0 +1,493 @@ + + + + + +Prototyp — Frontend-Zustandsmodell nach dem WebSocket-Umbau + + + +
+ +

Frontend-Zustandsmodell nach dem WebSocket-Umbau

+

Wegwerf-Prototyp zu Ticket 10 der Map websocket-realtime. Nur zum Durchklicken — kein Produktionscode.

+ +
+ Die Frage, die dieser Prototyp beantwortet +

Der Client hält Verbindungen zu mehreren unabhängigen Servern. Der Rust-Layer besitzt die Verbindungen, führt die Cursor und lädt selbst nach; das Frontend bekommt fertige Entitäten geliefert und hat keine Cursor-Logik. Trägt dieses Zustandsmodell die unangenehmen Fälle — Nachricht in einer nicht geöffneten Conversation, optimistisch gesendete Nachricht, die gleich nochmal vom Server kommt, Bearbeitung, Löschung, erzwungener Neuabgleich, und ein einzelner ausgefallener Server neben funktionierenden?

+

Die beiden Schalter unten sind die eigentlich offenen Entscheidungen. Stell sie um und fahr dieselben Durchläufe nochmal — der Unterschied ist der Punkt.

+
+ + +
+
+ +
+
+

Aktueller Zustand

+
+

Was gerade passiert ist

+
+
+ +
+

Freies Ausprobieren

+
+
+
+ +

Geführte Durchläufe

+
+
+

+
    +
    +
    +
    + +
    + Prototyp — wird nicht ausgeliefert. Der Reducer im ersten <script>-Block ist der Teil, der in echten Code übernommen werden kann; die Seite drumherum nicht. +
    +
    + + + + + +