From 50ef40d2e0ea1ddf488fa1fca193477902f3f34d Mon Sep 17 00:00:00 2001 From: Sayuop Date: Tue, 25 Nov 2025 10:11:05 +0100 Subject: [PATCH] Release v1.1.1: Critical timer bug fix Fixed critical bug where actual time spent on tasks was being reset to 0 when resuming work after a break in Pomodoro mode. ## Bug Fix - Fixed timer actual time resetting to 0 when skipping break or resuming work - Added preserveActualTime parameter to stopTimer() function - Actual time now correctly accumulates across multiple Pomodoro sessions --- main.js | 10 ++++++---- manifest.json | 2 +- package.json | 2 +- src/main.ts | 15 ++++++++------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/main.js b/main.js index 97d8dcb..8c6af80 100644 --- a/main.js +++ b/main.js @@ -1287,7 +1287,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin { const task = this.data.tasks.find((t) => t.id === taskId); if (!task) return; - this.stopTimer(); + this.stopTimer(true); this.activeTaskId = taskId; task.isActive = true; this.isBreakMode = false; @@ -1325,7 +1325,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin { const task = this.data.tasks.find((t) => t.id === taskId); if (!task) return; - this.stopTimer(); + this.stopTimer(true); this.activeTaskId = taskId; task.isActive = true; this.isBreakMode = false; @@ -1446,7 +1446,7 @@ var ImmersePlugin = class extends import_obsidian4.Plugin { this.updateStatusBar(); this.refreshView(); } - stopTimer() { + stopTimer(preserveActualTime = false) { if (this.timerInterval) { window.clearInterval(this.timerInterval); this.timerInterval = null; @@ -1455,7 +1455,9 @@ var ImmersePlugin = class extends import_obsidian4.Plugin { const task = this.data.tasks.find((t) => t.id === this.activeTaskId); if (task) { task.isActive = false; - task.actualMinutes = 0; + if (!preserveActualTime) { + task.actualMinutes = 0; + } } } this.isTimerRunning = false; diff --git a/manifest.json b/manifest.json index f6215ae..36738aa 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "immerse", "name": "Immerse", - "version": "1.1.0", + "version": "1.1.1", "minAppVersion": "0.15.0", "description": "A Blitzit-inspired task management and focus timer plugin. Plan your day, track time with Pomodoro technique, and crush your tasks with satisfying checkoffs.", "author": "Crib", diff --git a/package.json b/package.json index 6faea98..d0b67a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "immerse", - "version": "1.1.0", + "version": "1.1.1", "description": "A Blitzit-inspired task management and focus timer plugin for Obsidian", "main": "main.js", "scripts": { diff --git a/src/main.ts b/src/main.ts index e688c13..856cff5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -544,8 +544,8 @@ export default class ImmersePlugin extends Plugin { const task = this.data.tasks.find(t => t.id === taskId); if (!task) return; - // Stop any existing timer - this.stopTimer(); + // Stop any existing timer, preserving actual time + this.stopTimer(true); // Set active task this.activeTaskId = taskId; @@ -606,7 +606,7 @@ export default class ImmersePlugin extends Plugin { const task = this.data.tasks.find(t => t.id === taskId); if (!task) return; - this.stopTimer(); + this.stopTimer(true); this.activeTaskId = taskId; task.isActive = true; this.isBreakMode = false; @@ -796,7 +796,7 @@ export default class ImmersePlugin extends Plugin { this.refreshView(); } - stopTimer() { + stopTimer(preserveActualTime: boolean = false) { if (this.timerInterval) { window.clearInterval(this.timerInterval); this.timerInterval = null; @@ -806,9 +806,10 @@ export default class ImmersePlugin extends Plugin { const task = this.data.tasks.find(t => t.id === this.activeTaskId); if (task) { task.isActive = false; - // Reset actual time when manually stopping (not after a break) - // This allows starting fresh next time - task.actualMinutes = 0; + // Only reset actual time when manually stopping (not when resuming after break) + if (!preserveActualTime) { + task.actualMinutes = 0; + } } }