diff --git a/docs/feature-sync.md b/docs/feature-sync.md index 42c2d1b..cc50d40 100644 --- a/docs/feature-sync.md +++ b/docs/feature-sync.md @@ -49,9 +49,23 @@ Use case: avoids MSAL silent refresh failures (Azure AD returning HTTP 400 on re ## Deploy -`deploy.ps1` uses `docker build --no-cache` to ensure TypeScript changes are always recompiled. +`deploy.ps1` uses normal `docker build` with layer caching. Only changed layers are pushed to ACR. -Without `--no-cache`, Docker reuses the server-build layer → old compiled JS runs in production. +`COPY server/ server/` triggers a cache miss whenever server source changes → tsc reruns automatically. `--no-cache` is not needed and was removed (it caused all layers to be rebuilt and pushed on every deploy, >40 MB). + +## Delta Push (client-side filtering) + +`pushAll(since)` only sends entities with `updatedAt > since.toISOString()`. A read-only client sends 0 entities and skips the HTTP request entirely. + +`fullSync()` passes `since=null` → pushes everything (used after DB reset or first sync). + +**Root cause for all-conflicts:** `upsertEntity` accepts only `clientVersion > serverVersion`. After a pull, client has `version == serverVersion` → equal-version entities are never pushed (filtered out by delta push). Without delta push, a read-only client would produce 700+ conflicts on every sync cycle. + +## Client identification (`X-Client-Id` header) + +Each browser instance generates a stable random ID in `localStorage['ka-clientId']`. The header value is `Browser·OS·id` (e.g. `Edge·Win·a3f2`, `Safari·iOS·x9k2`). + +Server logs `client:` field in `[sync/push]` and `[sync/pull]` entries. ## ECONNRESET on POST /api/sync/push diff --git a/ka-note/VERSION b/ka-note/VERSION index 8865fe5..ff128b8 100644 --- a/ka-note/VERSION +++ b/ka-note/VERSION @@ -1 +1 @@ -1.1.54 \ No newline at end of file +1.1.57 \ No newline at end of file diff --git a/ka-note/client/src/lib/components/AgendaView.svelte b/ka-note/client/src/lib/components/AgendaView.svelte index 1b2dc9b..b3641f8 100644 --- a/ka-note/client/src/lib/components/AgendaView.svelte +++ b/ka-note/client/src/lib/components/AgendaView.svelte @@ -49,9 +49,9 @@ showSplit ? openTopics : [...openTopics, ...processedTopics] ); - async function handleCreate(title: string) { + async function handleCreate(title: string, body?: string) { const topic = await createTopic(contextId, title); - await createHistoryEntry(topic.id, today(), 'Thema angelegt.'); + await createHistoryEntry(topic.id, today(), body ?? 'Thema angelegt.'); } // --- Drag & Drop --- diff --git a/ka-note/client/src/lib/components/TopicInput.svelte b/ka-note/client/src/lib/components/TopicInput.svelte index a832657..c310a03 100644 --- a/ka-note/client/src/lib/components/TopicInput.svelte +++ b/ka-note/client/src/lib/components/TopicInput.svelte @@ -1,34 +1,36 @@
- raw = md} + onsave={handleCreate} />