From 3e4ad6ec91304499e11e31858ea9f54fc8f22f4c Mon Sep 17 00:00:00 2001 From: altair823 Date: Fri, 1 May 2026 21:35:31 +0900 Subject: [PATCH] refactor(trash): emptyTrash IPC dedup query (review T12 nit) --- src/main/ipc/inboxApi.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/ipc/inboxApi.ts b/src/main/ipc/inboxApi.ts index 85e9c4c..374095d 100644 --- a/src/main/ipc/inboxApi.ts +++ b/src/main/ipc/inboxApi.ts @@ -77,10 +77,12 @@ export function registerInboxApi(deps: InboxIpcDeps): void { }); ipcMain.handle('inbox:emptyTrash', async () => { - const trashed = deps.repo.listTrashed({ limit: 1 }); + // limit 200 한 번 — UI 표시 cap. count > 200 시 dialog message 만 부정확하지만 + // emptyTrash() 내부 SQL 은 LIMIT 없으므로 실제 삭제는 모든 trash 노트 적용. + // v0.2.4 에서 repo.countTrashed() 추가 시 둘 다 정확해짐. + const trashed = deps.repo.listTrashed({ limit: 200 }); if (trashed.length === 0) return { confirmed: true, count: 0 }; - // 정확한 카운트 위해 limit 200 으로 다시 조회 - const fullCount = deps.repo.listTrashed({ limit: 200 }).length; + const fullCount = trashed.length; const win = deps.getInboxWindow(); const opts: Electron.MessageBoxOptions = { type: 'question',