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()],