fix(paket a): URL-Reload ohne Rückfrage, Letztes-Dokument-Hinweis, Fremd-Tab-Warnung (D84)

1. Neu laden fragt bei URL-Dokumenten nicht mehr (F5 verwirft ohnehin
   still, D23); bei Datei-Dokumenten bleibt die Rückfrage. Dabei gefunden
   und behoben: Der Knopf erschien auch bei Server-Dokumenten und hätte
   die JSON-Antwort der API als Text an alle gepusht.
2. Die Rückfrage beim letzten Dokument sagt, dass danach wieder das
   Beispiel dasteht (docDeleteLastConfirm, 9 Sprachen).
3. Ein zweiter Tab, der in dieselbe Ablage schreibt, wird per
   storage-Ereignis erkannt und gemeldet (tabConflict, isDocKey in
   docstore.js) — kein Sync, aber kein stiller Verlust mehr.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
mhoennig
2026-08-27 08:02:15 +02:00
co-authored by Claude Fable 5
parent 83dc329b43
commit c438a88344
6 changed files with 128 additions and 7 deletions
+17 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest';
import { readDocs, storeDocs, storeDocText, docTextKey,
import { readDocs, storeDocs, storeDocText, docTextKey, isDocKey,
LS_DOCS, LS_SRC, DOC_TEXT_PREFIX } from '../src/docstore.js';
/* Storage-Attrappe mit Zähler — die Vergleich-vor-Schreiben-Regel ist nur
@@ -101,3 +101,19 @@ describe('docstore — Index + Text je Dokument (D83)', () => {
expect(() => storeDocs(voll, [A], [])).toThrow();
});
});
describe('isDocKey — Fremd-Tab-Erkennung (D84)', () => {
it('erkennt Index, aktives Dokument, Spiegel und Text-Schlüssel', () => {
expect(isDocKey(LS_DOCS)).toBe(true);
expect(isDocKey('werkbaum-active')).toBe(true);
expect(isDocKey(LS_SRC)).toBe(true);
expect(isDocKey(DOC_TEXT_PREFIX + 'live:https://x/api/v1/documents/a')).toBe(true);
});
it('fremde Schlüssel und Ansichts-Zustand sind keine Dokument-Schlüssel', () => {
expect(isDocKey('werkbaum-ui')).toBe(false);
expect(isDocKey('werkbaum-lang')).toBe(false);
expect(isDocKey('werkbaum-snaps')).toBe(false);
expect(isDocKey(null)).toBe(false);
});
});