Skip to content

Commit 3b356b9

Browse files
committed
fix: reset display state tracking when switching between focus and break modes
1 parent 8a60b6d commit 3b356b9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/core/pomodoro-timer.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,24 @@ export class PomodoroTimer {
835835
} else {
836836
this.currentMode = 'break';
837837
}
838+
839+
// Reset display state tracking when switching to break modes
840+
this._lastLoggedState = null;
841+
this._lastAutoPausedLogged = false;
842+
this._lastPausedLogged = false;
838843
} else {
839844
this.currentMode = 'focus';
845+
846+
// Reset display state tracking when switching to focus mode
847+
this._lastLoggedState = null;
848+
this._lastAutoPausedLogged = false;
849+
this._lastPausedLogged = false;
850+
851+
// Restore TagManager display when returning to focus mode
852+
if (window.tagManager) {
853+
window.tagManager.updateStatusDisplay();
854+
}
855+
840856
if (this.completedPomodoros < this.totalSessions) {
841857
this.currentSession = this.completedPomodoros + 1;
842858
}
@@ -884,8 +900,18 @@ export class PomodoroTimer {
884900
} else {
885901
this.currentMode = 'break';
886902
}
903+
904+
// Reset display state tracking when switching to break modes
905+
this._lastLoggedState = null;
906+
this._lastAutoPausedLogged = false;
907+
this._lastPausedLogged = false;
887908
} else {
888909
this.currentMode = 'focus';
910+
911+
// Reset display state tracking when switching to focus mode
912+
this._lastLoggedState = null;
913+
this._lastAutoPausedLogged = false;
914+
this._lastPausedLogged = false;
889915

890916
// Restore TagManager display when returning to focus mode
891917
if (window.tagManager) {
@@ -962,6 +988,11 @@ export class PomodoroTimer {
962988
} else {
963989
this.currentMode = 'break';
964990
}
991+
992+
// Reset display state tracking when switching to break modes
993+
this._lastLoggedState = null;
994+
this._lastAutoPausedLogged = false;
995+
this._lastPausedLogged = false;
965996
}
966997
} else {
967998
// Break completed
@@ -971,6 +1002,11 @@ export class PomodoroTimer {
9711002
} else {
9721003
// Traditional behavior - go back to focus
9731004
this.currentMode = 'focus';
1005+
1006+
// Reset display state tracking when switching to focus mode
1007+
this._lastLoggedState = null;
1008+
this._lastAutoPausedLogged = false;
1009+
this._lastPausedLogged = false;
9741010

9751011
// Restore TagManager display when returning to focus mode
9761012
if (window.tagManager) {

0 commit comments

Comments
 (0)