From 4ad0b7d2ffffdce86f6545852c0f2169fd1ad64e Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Mon, 1 Dec 2025 17:05:07 -0700 Subject: [PATCH] no double persist snapshot --- pttodoest/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pttodoest/src/main.rs b/pttodoest/src/main.rs index a1dd691..55cfeff 100755 --- a/pttodoest/src/main.rs +++ b/pttodoest/src/main.rs @@ -167,7 +167,9 @@ impl File { pub fn stage_persisted(&self) -> Result<(), String> { let persisted_as_snapshot = self.events()?.snapshot()?; - self.append(Delta::snapshot(persisted_as_snapshot.clone()))?; + if persisted_as_snapshot != self.events()?.last_snapshot() { + self.append(Delta::snapshot(persisted_as_snapshot.clone()))?; + } let plaintext = serde_yaml::to_string(&persisted_as_snapshot).unwrap(); let mut f = std::fs::File::create(&self.file).expect("failed to open file for writing"); writeln!(f, "{}", plaintext).expect("failed to write");