mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
refactor(tasks): use action instead of weird subscribe combo for starting first startable
This commit is contained in:
parent
181829076d
commit
816fd0c376
2 changed files with 6 additions and 9 deletions
|
|
@ -21,6 +21,7 @@ import {
|
|||
RemoveTimeSpent,
|
||||
RestoreTask,
|
||||
SetCurrentTask,
|
||||
StartFirstStartable,
|
||||
TaskActionTypes,
|
||||
ToggleStart,
|
||||
ToggleTaskShowSubTasks,
|
||||
|
|
@ -58,7 +59,6 @@ import { getWorklogStr } from '../../util/get-work-log-str';
|
|||
import { Actions, ofType } from '@ngrx/effects';
|
||||
import { IssueService } from '../issue/issue.service';
|
||||
import { ProjectService } from '../project/project.service';
|
||||
import { tasks_v1 } from 'googleapis';
|
||||
|
||||
|
||||
@Injectable({
|
||||
|
|
@ -224,6 +224,10 @@ export class TaskService {
|
|||
}
|
||||
}
|
||||
|
||||
startFirstStartable() {
|
||||
this._store.dispatch(new StartFirstStartable());
|
||||
}
|
||||
|
||||
async loadStateForProject(projectId) {
|
||||
const lsTaskState = await this._persistenceService.loadTasksForProject(projectId);
|
||||
this.loadState(lsTaskState || initialTaskState);
|
||||
|
|
|
|||
|
|
@ -109,13 +109,6 @@ export class WorkViewPageComponent implements OnInit, OnDestroy {
|
|||
startWork() {
|
||||
// TODO refactor to action
|
||||
this.isPlanYourDay = false;
|
||||
this._subs.add(this.taskService.startableTaskIds$
|
||||
.pipe(take(1))
|
||||
.subscribe(taskIds => {
|
||||
const nextTaskId = taskIds && taskIds[0];
|
||||
if (nextTaskId) {
|
||||
this.taskService.setCurrentId(nextTaskId);
|
||||
}
|
||||
}));
|
||||
this.taskService.startFirstStartable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue