mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-19 01:17:31 +00:00
fix(tasks): clear remindAt when rescheduling task via planner (#6342)
planTaskForDay set dueDay and cleared dueWithTime but left remindAt untouched. The reminder worker kept firing for the past remindAt value, causing the reminder popup to reopen in a loop after "Reschedule for tomorrow".
This commit is contained in:
parent
d83f0b69c0
commit
80007dbc19
2 changed files with 30 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import { TaskSharedActions } from '../../../root-store/meta/task-shared.actions'
|
|||
import { INBOX_PROJECT } from '../../project/project.const';
|
||||
import { TimeTrackingActions } from '../../time-tracking/store/time-tracking.actions';
|
||||
import { _resetDevErrorState } from '../../../util/dev-error';
|
||||
import { PlannerActions } from '../../planner/store/planner.actions';
|
||||
|
||||
describe('Task Reducer', () => {
|
||||
const createTask = (id: string, partial: Partial<Task> = {}): Task => ({
|
||||
|
|
@ -832,4 +833,32 @@ describe('Task Reducer', () => {
|
|||
expect(state.currentTaskId).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('PlannerActions.planTaskForDay', () => {
|
||||
it('should clear remindAt when rescheduling a task', () => {
|
||||
const taskWithReminder = createTask('task-remind', {
|
||||
remindAt: Date.now() - 60000,
|
||||
dueDay: '2024-01-01',
|
||||
});
|
||||
const stateWithReminder: TaskState = {
|
||||
...initialTaskState,
|
||||
ids: ['task-remind'],
|
||||
entities: {
|
||||
'task-remind': taskWithReminder,
|
||||
},
|
||||
currentTaskId: null,
|
||||
};
|
||||
|
||||
const action = PlannerActions.planTaskForDay({
|
||||
task: taskWithReminder,
|
||||
day: '2024-01-02',
|
||||
});
|
||||
|
||||
const result = taskReducer(stateWithReminder, action);
|
||||
|
||||
expect(result.entities['task-remind']!.remindAt).toBeUndefined();
|
||||
expect(result.entities['task-remind']!.dueDay).toBe('2024-01-02');
|
||||
expect(result.entities['task-remind']!.dueWithTime).toBeUndefined();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -669,6 +669,7 @@ export const taskReducer = createReducer<TaskState>(
|
|||
changes: {
|
||||
dueDay: day,
|
||||
dueWithTime: undefined,
|
||||
remindAt: undefined,
|
||||
},
|
||||
},
|
||||
state,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue