From 695efb3112508a311f53b23cac440a8e7394569c Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 8 Oct 2026 14:20:36 -0400 Subject: [PATCH] The store reads a note's body through note_body everywhere should_snapshot and snapshot_revision each wrote out the SELECT that note_body already is. DRY pass #2, batch 2, F7 (#5372). Co-Authored-By: Claude Opus 5.5 --- core/src/local/store.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/src/local/store.rs b/core/src/local/store.rs index 811eb6e..5b372d9 100644 --- a/core/src/local/store.rs +++ b/core/src/local/store.rs @@ -561,9 +561,7 @@ const REVISION_WINDOW_MINUTES: i64 = 10; /// own — no "commit" the client has to declare, and no protocol surface to carry it, /// which matters because sync-apply takes this same path. fn should_snapshot(conn: &Connection, id: &str, new_body: &str) -> rusqlite::Result { - let current: String = - conn.query_row("SELECT body FROM notes WHERE id = ?1", [id], |r| r.get(0))?; - if current == new_body { + if note_body(conn, id)? == new_body { return Ok(false); } // String comparison, not date maths: timestamps are RFC3339 UTC with a fixed @@ -578,8 +576,7 @@ fn should_snapshot(conn: &Connection, id: &str, new_body: &str) -> rusqlite::Res } fn snapshot_revision(conn: &Connection, id: &str) -> rusqlite::Result<()> { - let body: String = - conn.query_row("SELECT body FROM notes WHERE id = ?1", [id], |r| r.get(0))?; + let body = note_body(conn, id)?; conn.execute( "INSERT INTO note_revisions (id, note_id, body, created_at) VALUES (?1, ?2, ?3, ?4)", params![new_id(), id, body, now()],