[195b] Objekteinstellungen-Fenster: Ops-Strom statt Neuladen des Projekts

Das Hauptfenster sammelt die vom Kern-Dokument angenommenen Ops (ProjectDocument.onChange:
Commit, Griff, Befehl, Import, Undo/Redo, Sprung) und schickt sie mit laufender Nummer; das
Fenster führt sie ohne Verlauf nach (applyRemote = doc_apply + applyOps). Rückfall Feld-Differenz
mit Vollabgleich bei Laden/Neu oder fehlenden Ops; Lücke oder abgelehnte Ops fordern den ganzen
Stand an. Grossgebäude: 0.4 ms statt 56 ms je Wandänderung (Linux, vitest).
This commit is contained in:
Claude committed 2026-11-12 04:06:04 +00:00
1 parent a3f0a37d9c
commit 2ab2b340cb
6 files changed
+403 -71

No files matched your search

+9 -4
View File
@@ -15,9 +15,10 @@ import { setSettingsArea } from "../panels/objectSettings/areaState";
import { expandAndFocusInfoGroup } from "../panels/objectInfo/infoGroupState";
import { setState } from "../state/appStore";
import { setChangeSink } from "../state/changeSink";
import { storeDocument } from "../state/historySlice";
import {
OBJECT_SETTINGS_PREFIX as PREFIX,
applyObjectSettingsSync,
ObjectSettingsReceiver,
mirrorIntoStore,
remoteHost,
type ObjectSettingsSnapshot,
@@ -50,9 +51,13 @@ export function ObjectSettingsWindowApp() {
void (async () => {
const { listen, emitTo } = await import("@tauri-apps/api/event");
if (disposed) return;
const receiver = new ObjectSettingsReceiver(storeDocument);
const ready = () => emitTo("main", `${PREFIX}-window-ready`).catch(() => {});
const off = await listen<ObjectSettingsSync>(`${PREFIX}-sync`, (e) => {
const next = applyObjectSettingsSync(snap, e.payload);
if (!next) return;
const next = receiver.receive(e.payload);
// Lücke in der Folge bzw. Ops abgelehnt: ganzen Stand neu anfordern.
if (next === "resync") void ready();
if (!next || next === "resync") return;
mirrorIntoStore(snap, next);
snap = next;
const f = next.ui.focus;
@@ -65,7 +70,7 @@ export function ObjectSettingsWindowApp() {
});
if (disposed) return off();
unlisten.push(off);
await emitTo("main", `${PREFIX}-window-ready`).catch(() => {});
await ready();
})();
const onKey = (e: KeyboardEvent) => {