diff --git a/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.html b/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.html
index bd38b2bd61..fb27ab068f 100644
--- a/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.html
+++ b/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.html
@@ -6,7 +6,7 @@
diff --git a/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.ts b/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.ts
index ef9ffef897..a0d949cbc7 100644
--- a/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.ts
+++ b/src/app/features/focus-mode/focus-mode-task-selection/focus-mode-task-selection.component.ts
@@ -7,7 +7,6 @@ import {
} from '@angular/core';
import { Task } from '../../tasks/task.model';
import { TaskService } from '../../tasks/task.service';
-import { first } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import {
setFocusSessionActivePage,
@@ -17,7 +16,6 @@ import { FocusModeMode, FocusModePage } from '../focus-mode.const';
import { T } from 'src/app/t.const';
import { FormsModule } from '@angular/forms';
import { MatButton } from '@angular/material/button';
-import { AsyncPipe } from '@angular/common';
import { TranslatePipe } from '@ngx-translate/core';
import { SelectTaskComponent } from '../../tasks/select-task/select-task.component';
import { selectFocusModeMode } from '../store/focus-mode.selectors';
@@ -29,7 +27,7 @@ import { selectFocusModeConfig } from '../../config/store/global-config.reducer'
templateUrl: './focus-mode-task-selection.component.html',
styleUrls: ['./focus-mode-task-selection.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
- imports: [FormsModule, MatButton, AsyncPipe, TranslatePipe, SelectTaskComponent],
+ imports: [FormsModule, MatButton, TranslatePipe, SelectTaskComponent],
})
export class FocusModeTaskSelectionComponent implements AfterViewInit, OnDestroy {
readonly taskService = inject(TaskService);
@@ -39,7 +37,7 @@ export class FocusModeTaskSelectionComponent implements AfterViewInit, OnDestroy
cfg = toSignal(this._store.select(selectFocusModeConfig));
selectedTask: string | Task | undefined;
- initialTask$ = this.taskService.firstStartableTask$.pipe(first());
+ initialTask = this.taskService.firstStartableTask;
focusTimeout = 0;
T: typeof T = T;
diff --git a/src/app/features/tasks/task.service.ts b/src/app/features/tasks/task.service.ts
index 2c2a2c48c7..35d409de51 100644
--- a/src/app/features/tasks/task.service.ts
+++ b/src/app/features/tasks/task.service.ts
@@ -1,6 +1,6 @@
import { nanoid } from 'nanoid';
import { first, map, take, withLatestFrom } from 'rxjs/operators';
-import { inject, Injectable } from '@angular/core';
+import { computed, inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import {
ArchiveTask,
@@ -38,7 +38,6 @@ import {
selectAllTasks,
selectCurrentTask,
selectCurrentTaskId,
- selectCurrentTaskOrParentWithData,
selectCurrentTaskParentOrCurrent,
selectIsTaskDataLoaded,
selectMainTasksWithoutTag,
@@ -135,10 +134,9 @@ export class TaskService {
// NOTE: we can't use share here, as we need the last emitted value
);
- firstStartableTask$: Observable =
- this._workContextService.startableTasksForActiveContext$.pipe(
- map((tasks) => tasks[0]),
- );
+ firstStartableTask = computed(
+ () => this._workContextService.startableTasksForActiveContext()[0],
+ );
taskDetailPanelTargetPanel$: Observable =
this._store.pipe(
@@ -146,11 +144,6 @@ export class TaskService {
// NOTE: we can't use share here, as we need the last emitted value
);
- currentTaskOrCurrentParent$: Observable = this._store.pipe(
- select(selectCurrentTaskOrParentWithData),
- // NOTE: we can't use share here, as we need the last emitted value
- );
-
isTaskDataLoaded$: Observable = this._store.pipe(
select(selectIsTaskDataLoaded),
);
diff --git a/src/app/features/work-context/work-context.service.ts b/src/app/features/work-context/work-context.service.ts
index 952a21ffc0..a2d6be11b2 100644
--- a/src/app/features/work-context/work-context.service.ts
+++ b/src/app/features/work-context/work-context.service.ts
@@ -1,5 +1,6 @@
import { inject, Injectable } from '@angular/core';
import { select, Store } from '@ngrx/store';
+import { toSignal } from '@angular/core/rxjs-interop';
import { combineLatest, interval, Observable, of, timer } from 'rxjs';
import {
WorkContext,
@@ -301,14 +302,15 @@ export class WorkContextService {
this.backlogTasks$,
]).pipe(map(([today, backlog]) => [...today, ...backlog]));
- startableTasksForActiveContext$: Observable = this._afterDataLoadedOnce$.pipe(
- switchMap(() => this._store$),
+ startableTasksForActiveContext$: Observable = this._store$.pipe(
select(selectStartableTasksForActiveContext),
shareReplay(1),
);
+ startableTasksForActiveContext = toSignal(this.startableTasksForActiveContext$, {
+ initialValue: [],
+ });
- trackableTasksForActiveContext$: Observable = this._afterDataLoadedOnce$.pipe(
- switchMap(() => this._store$),
+ trackableTasksForActiveContext$: Observable = this._store$.pipe(
select(selectTrackableTasksForActiveContext),
);