Add capture-in-progress guard to prevent duplicate snapshots
Concurrent captureSnapshot calls (e.g. manual Ctrl+S overlapping a debounced auto-capture) could both pass the hash check before either sets the hash, creating duplicates. A simple boolean flag now ensures only one capture runs at a time. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1411,8 +1411,16 @@ async function showPreviewModal(record) {
|
||||
|
||||
// ─── Snapshot Capture ────────────────────────────────────────────────
|
||||
|
||||
let captureInProgress = false;
|
||||
|
||||
async function captureSnapshot(label = "Auto") {
|
||||
if (restoreLock) return false;
|
||||
if (captureInProgress) return false;
|
||||
captureInProgress = true;
|
||||
try { return await _captureSnapshotInner(label); } finally { captureInProgress = false; }
|
||||
}
|
||||
|
||||
async function _captureSnapshotInner(label) {
|
||||
|
||||
const graphData = getGraphData();
|
||||
if (!graphData) return false;
|
||||
|
||||
Reference in New Issue
Block a user