a very good jj gui
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: remove debug console.log statements from db.ts and mocks

+4 -44
+3 -18
apps/desktop/src/db.ts
··· 122 122 if (event.payload === repoPath) { 123 123 // Skip if there are in-flight mutations - let the mutation handle state 124 124 if (inFlightMutations.size > 0) { 125 - console.log("[watcher] skipping - in-flight mutations:", [...inFlightMutations]); 126 125 return; 127 126 } 128 127 129 - console.log("[watcher] invalidating queries for:", repoPath); 130 128 // Invalidate ALL queries for this repo - TanStack Query will refetch 131 129 await queryClient.invalidateQueries({ queryKey: ["revisions", repoPath] }); 132 130 await queryClient.invalidateQueries({ queryKey: ["revision-changes", repoPath] }); ··· 169 167 170 168 try { 171 169 await upsertRepository(repository); 172 - console.log("[addRepository] upsertRepository completed"); 173 170 } catch (err) { 174 171 // Revert on failure 175 172 collection.utils.writeDelete(repository.id); 176 - console.error("[addRepository] failed, reverting:", err); 177 173 throw err; 178 174 } 179 175 } ··· 187 183 188 184 try { 189 185 await upsertRepository(repository); 190 - console.log("[updateRepository] upsertRepository completed"); 191 186 } catch (err) { 192 187 // Revert on failure 193 188 if (current) { ··· 195 190 } else { 196 191 collection.utils.writeDelete(repository.id); 197 192 } 198 - console.error("[updateRepository] failed, reverting:", err); 199 193 throw err; 200 194 } 201 195 } ··· 209 203 210 204 try { 211 205 await removeRepository(repositoryId); 212 - console.log("[deleteRepository] removeRepository completed"); 213 206 } catch (err) { 214 207 // Revert on failure 215 208 if (current) { 216 209 collection.utils.writeUpsert([current]); 217 210 } 218 - console.error("[deleteRepository] failed, reverting:", err); 219 211 throw err; 220 212 } 221 213 } ··· 278 270 currentWcRevision: Revision | null, 279 271 ) { 280 272 const mutationId = `edit-${Date.now()}-${Math.random()}`; 281 - console.log("[editRevision] start, mutationId:", mutationId); 282 273 283 274 // Optimistic update 284 275 const updates: Revision[] = []; ··· 291 282 // Track the mutation and fire backend 292 283 trackMutation(mutationId, jjEdit(repoPath, targetRevision.change_id_short)) 293 284 .then(() => { 294 - console.log("[editRevision] completed"); 295 285 // Invalidate to get fresh data from backend 296 286 queryClient.invalidateQueries({ queryKey: ["revisions", repoPath] }); 297 287 }) 298 - .catch((err) => { 299 - console.error("[editRevision] failed:", err); 288 + .catch(() => { 300 289 // Revert optimistic update 301 290 const revertUpdates: Revision[] = []; 302 291 if ( ··· 361 350 // Invalidate to get authoritative data (correct commit_id, short_id, etc.) 362 351 queryClient.invalidateQueries({ queryKey: ["revisions", repoPath] }); 363 352 }) 364 - .catch((err) => { 365 - console.error("[newRevision] failed:", err); 353 + .catch(() => { 366 354 // Revert optimistic update 367 355 if (optimisticRevision) { 368 356 collection.utils.writeDelete(getRevisionKey(optimisticRevision)); ··· 379 367 revision: Revision, 380 368 ) { 381 369 const mutationId = `abandon-${Date.now()}-${Math.random()}`; 382 - console.log("[abandonRevision] abandoning:", revision.change_id_short, "mutationId:", mutationId); 383 370 384 371 // For working copy, jj creates a new WC - can't do optimistic delete 385 372 // For other revisions, we can optimistically remove ··· 390 377 // Track the mutation and fire backend 391 378 trackMutation(mutationId, jjAbandon(repoPath, revision.change_id_short)) 392 379 .then(() => { 393 - console.log("[abandonRevision] completed"); 394 380 // Invalidate to get fresh data (especially for WC abandon which creates new WC) 395 381 queryClient.invalidateQueries({ queryKey: ["revisions", repoPath] }); 396 382 }) 397 - .catch((err) => { 398 - console.error("[abandonRevision] failed:", err); 383 + .catch(() => { 399 384 // Re-add on failure (only if we deleted it) 400 385 if (!revision.is_working_copy) { 401 386 collection.utils.writeUpsert([revision]);
+1 -26
apps/desktop/src/mocks/setup.ts
··· 882 882 }, 883 883 find_repository: () => "/Users/demo/projects/tatami", 884 884 get_revisions: () => { 885 - console.log("[Mock] get_revisions called, returning", mockRevisions.length, "revisions"); 886 885 return mockRevisions; 887 886 }, 888 887 get_status: (): WorkingCopyStatus => { ··· 974 973 }, 975 974 jj_edit: (args) => { 976 975 const changeId = args.changeId as string; 977 - console.log("[Mock] jj_edit called with changeId:", changeId); 978 976 // Find target revision by change_id (handling short IDs) 979 977 const targetIndex = mockRevisions.findIndex( 980 978 (r) => r.change_id.startsWith(changeId) || r.change_id_short === changeId, 981 979 ); 982 980 if (targetIndex < 0) { 983 - console.warn(`[Mock] jj_edit: revision not found: ${changeId}`); 984 981 return undefined; 985 982 } 986 983 987 - console.log("[Mock] jj_edit: found revision at index", targetIndex); 988 - 989 984 // Clear working copy from all revisions, set on target 990 985 mockRevisions = mockRevisions.map((r, i) => ({ 991 986 ...r, 992 987 is_working_copy: i === targetIndex, 993 988 })); 994 989 995 - console.log( 996 - "[Mock] jj_edit: updated mockRevisions, new WC:", 997 - mockRevisions.find((r) => r.is_working_copy)?.change_id_short, 998 - ); 999 - 1000 990 return undefined; 1001 991 }, 1002 992 jj_abandon: (args) => { ··· 1006 996 (r) => r.change_id.startsWith(changeId) || r.change_id_short === changeId, 1007 997 ); 1008 998 if (revisionIndex < 0) { 1009 - console.warn(`[Mock] jj_abandon: revision not found: ${changeId}`); 1010 999 return undefined; 1011 1000 } 1012 1001 ··· 1088 1077 1089 1078 export async function setupMocks(): Promise<void> { 1090 1079 if (IS_TAURI) { 1091 - console.log("[Mocks] Running in Tauri, skipping mock setup"); 1092 1080 return; 1093 1081 } 1094 - 1095 - console.log("[Mocks] Not in Tauri, setting up IPC mocks..."); 1096 1082 1097 1083 // Dynamically import to avoid loading in Tauri 1098 1084 const { mockIPC } = await import("@tauri-apps/api/mocks"); 1099 1085 1100 1086 mockIPC((cmd, args) => { 1101 - console.log(`[Mock] IPC call: ${cmd}`, args); 1102 1087 const handler = handlers[cmd]; 1103 1088 if (!handler) { 1104 - console.warn(`[Mock] No handler for command: ${cmd}`, args); 1105 1089 return undefined; 1106 1090 } 1107 - try { 1108 - const result = handler((args ?? {}) as Record<string, unknown>); 1109 - console.log(`[Mock] IPC result for ${cmd}:`, result); 1110 - return result; 1111 - } catch (error) { 1112 - console.error(`[Mock] IPC error for ${cmd}:`, error); 1113 - throw error; 1114 - } 1091 + return handler((args ?? {}) as Record<string, unknown>); 1115 1092 }); 1116 - 1117 - console.log("[Mocks] IPC mocks ready"); 1118 1093 }