Skip to content

Build your personal knowledge base with Trilium Notes

fix(sync): give the divergence notification a title and clearer wording

Elian Dorane94dce26aed0
diff --git a/apps/client/src/services/ws.spec.ts b/apps/client/src/services/ws.spec.ts
index c8b9c94b70..e2d797218c 100644
--- a/apps/client/src/services/ws.spec.ts
+++ b/apps/client/src/services/ws.spec.ts
@@ -7,6 +7,7 @@ import { buildNote } from "../test/easy-froca";
// and swap behaviour per test without re-mocking.
const toast = vi.hoisted(() => ({
showError: vi.fn(),
+ showErrorTitleAndMessage: vi.fn(),
showMessage: vi.fn(),
showPersistent: vi.fn(),
closePersistent: vi.fn()
@@ -85,8 +86,10 @@ describe("dispatchMessage", () => {
expect(utilsCtrl.reloadFrontendApp).toHaveBeenCalledWith(expect.stringContaining("reload"));
await ws.dispatchMessage({ type: "sync-hash-check-failed", sectors: ["blobs/9"] } as any);
+ expect(toast.showErrorTitleAndMessage).toHaveBeenCalledTimes(1);
+
await ws.dispatchMessage({ type: "consistency-checks-failed" } as any);
- expect(toast.showError).toHaveBeenCalledTimes(2);
+ expect(toast.showError).toHaveBeenCalledTimes(1);
await ws.dispatchMessage({ type: "api-log-messages", noteId: "n1", messages: ["a"] } as any);
expect(appCtx.triggerEvent).toHaveBeenCalledWith("apiLogMessages", { noteId: "n1", messages: ["a"] });
diff --git a/apps/client/src/services/ws.ts b/apps/client/src/services/ws.ts
index 686021ffb7..e10e496560 100644
--- a/apps/client/src/services/ws.ts
+++ b/apps/client/src/services/ws.ts
@@ -100,10 +100,14 @@ export async function dispatchMessage(message: WebSocketMessage) {
} else if (messageType === "sync-hash-check-failed") {
// Not auto-dismissed after the usual few seconds: syncing stays broken until the user acts,
// and the backend only reports it once (it would otherwise recur with every sync attempt).
- // The sector list is interpolated unescaped ({{- }}) — the toast renders its message as
- // text, so i18next's HTML escaping would only turn the `entityName/sector` slash into a
+ // The sector list is interpolated unescaped ({{- }}) since the toast renders its message as
+ // text: i18next's HTML escaping would only turn the `entityName/sector` slash into a
// literal `/`.
- toastService.showError(t("ws.sync-hash-check-failed", { sectors: (msg.sectors ?? []).join(", ") }), 50 * 60000);
+ toastService.showErrorTitleAndMessage(
+ t("ws.sync-hash-check-failed-title"),
+ t("ws.sync-hash-check-failed", { sectors: (msg.sectors ?? []).join(", ") }),
+ 50 * 60000
+ );
} else if (messageType === "consistency-checks-failed") {
toastService.showError(t("ws.consistency-checks-failed"), 50 * 60000);
} else if (messageType === "api-log-messages") {
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 110073c503..f00dc0f118 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2748,7 +2748,8 @@
"backend_scripting_disabled_more_info": "More info"
},
"ws": {
- "sync-hash-check-failed": "Sync stopped: this database and the sync server hold data that could not be reconciled by re-syncing it ({{- sectors}}). Syncing will keep failing until this is resolved — see the logs for details.",
+ "sync-hash-check-failed-title": "Sync stopped",
+ "sync-hash-check-failed": "This database and the sync server hold data that could not be reconciled by re-syncing it ({{- sectors}}).\n\nSyncing will keep failing until this is resolved. See the logs for details.",
"consistency-checks-failed": "Consistency checks failed! See logs for details.",
"encountered-error": "Encountered error \"{{message}}\", check out the console.",
"lost-websocket-connection-title": "Lost connection to the server",