Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(notes): share-state writes no longer bump updated_at; deep-link stash survives fire-and-forget push

Gabriel Stein2007cf972384
diff --git a/main.js b/main.js
index 34bac8dd5..e3e644bf3 100644
--- a/main.js
+++ b/main.js
@@ -546,8 +546,10 @@ function handleInvitationDeepLink(deepLinkUrl) {
if (isLiveWindow(windowManager.controlPanelWindow)) {
windowManager.controlPanelWindow.show();
windowManager.controlPanelWindow.focus();
+ // Best-effort fast path; the renderer may not be listening yet (reload,
+ // lazy mount). Only the get-pending-invitation-token pull consumes the
+ // stash — the renderer also pulls on push receipt to mark it handled.
windowManager.controlPanelWindow.webContents.send("workspace-invitation-token", token);
- pendingInvitationDeepLinkToken = null;
} else {
windowManager.createControlPanelWindow();
}
diff --git a/preload.js b/preload.js
index 269b19395..9aaa655b6 100644
--- a/preload.js
+++ b/preload.js
@@ -105,6 +105,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
return () => ipcRenderer.removeListener("semantic-reindex-progress", listener);
},
updateNoteCloudId: (id, cloudId) => ipcRenderer.invoke("db-update-note-cloud-id", id, cloudId),
+ updateNoteShareState: (id, state) => ipcRenderer.invoke("db-update-note-share-state", id, state),
// Folder functions
getFolders: () => ipcRenderer.invoke("db-get-folders"),
diff --git a/src/helpers/database.js b/src/helpers/database.js
index 43f61f557..44f568430 100644
--- a/src/helpers/database.js
+++ b/src/helpers/database.js
@@ -1491,8 +1491,6 @@ class DatabaseManager {
"deleted_at",
"client_note_id",
"cloud_id",
- "is_shared",
- "share_token",
];
const fields = [];
const values = [];
@@ -2288,6 +2286,25 @@ class DatabaseManager {
}
}
+ // Share bookkeeping, not a content edit — must not bump updated_at (which
+ // would reorder note lists and churn sync last-write-wins comparisons).
+ updateNoteShareState(id, { is_shared, share_token }) {
+ try {
+ if (!this.db) throw new Error("Database not initialized");
+ if (share_token !== undefined) {
+ this.db
+ .prepare("UPDATE notes SET is_shared = ?, share_token = ? WHERE id = ?")
+ .run(is_shared, share_token, id);
+ } else {
+ this.db.prepare("UPDATE notes SET is_shared = ? WHERE id = ?").run(is_shared, id);
+ }
+ return this.db.prepare("SELECT * FROM notes WHERE id = ?").get(id);
+ } catch (error) {
+ debugLogger.error("Error updating note share state", { error: error.message }, "database");
+ throw error;
+ }
+ }
+
cleanup() {
try {
if (this.db) {
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index c14de5d5c..0f9df7f8d 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -1159,6 +1159,14 @@ class IPCHandlers {
return this.databaseManager.updateNoteCloudId(id, cloudId);
});
+ ipcMain.handle("db-update-note-share-state", async (event, id, state) => {
+ const note = this.databaseManager.updateNoteShareState(id, state);
+ if (note) {
+ setImmediate(() => this.broadcastToWindows("note-updated", note));
+ }
+ return note;
+ });
+
ipcMain.handle("db-get-folders", async () => {
return this.databaseManager.getFolders();
});
diff --git a/src/stores/noteStore.ts b/src/stores/noteStore.ts
index b9affe97f..da2910380 100644
--- a/src/stores/noteStore.ts
+++ b/src/stores/noteStore.ts
@@ -215,7 +215,7 @@ export async function persistNoteShareState(
noteId: number,
updates: { is_shared: number; share_token?: string | null }
): Promise<void> {
- await window.electronAPI?.updateNote(noteId, updates);
+ await window.electronAPI?.updateNoteShareState(noteId, updates);
}
export function getShareCacheEntry(cloudId: string): NoteShareCacheEntry | null {
diff --git a/src/types/electron.ts b/src/types/electron.ts
index 47c5bcedf..2a1181e39 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -605,8 +605,6 @@ declare global {
participants?: string | null;
diarization_enabled?: number | null;
expected_speaker_count?: number | null;
- is_shared?: number;
- share_token?: string | null;
}
) => Promise<{ success: boolean; note?: NoteItem }>;
deleteNote: (id: number) => Promise<{ success: boolean }>;
@@ -626,6 +624,10 @@ declare global {
callback: (data: { done: number; total: number }) => void
) => () => void;
updateNoteCloudId: (id: number, cloudId: string) => Promise<NoteItem>;
+ updateNoteShareState: (
+ id: number,
+ state: { is_shared: number; share_token?: string | null }
+ ) => Promise<NoteItem>;
// Folder operations
getFolders: () => Promise<FolderItem[]>;