@zeniai/client-epic-state 4.20.2-beta35RR → 4.20.2-beta37RR

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTasks } from '../../../../entity/task/taskReducer';
5
5
  import { getTaskById } from '../../../../entity/task/taskSelector';
6
6
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
- import { removeTaskFromList } from '../../taskListView/taskListReducer';
7
+ import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
8
8
  import { archiveTask, archiveTaskSuccessOrFailure } from '../taskDetailReducer';
9
9
  // Epic function to handle archiving of tasks
10
10
  export const archiveTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(archiveTask.match), mergeMap((action) => handleArchiveTask(action.payload.taskId, state$, zeniAPI)));
@@ -27,6 +27,7 @@ const handleApiResponse = (response, taskId) => {
27
27
  const fetchActions = [
28
28
  updateTasks(response.data.tasks),
29
29
  removeTaskFromList(taskId),
30
+ fetchTaskList(),
30
31
  archiveTaskSuccessOrFailure({
31
32
  fetchState: 'Completed',
32
33
  taskId,
@@ -2,7 +2,7 @@ import { from, of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
5
- import { removeTaskFromList } from '../../taskListView/taskListReducer';
5
+ import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
6
6
  import { deleteTask, deleteTaskSuccessOrFailure } from '../taskDetailReducer';
7
7
  export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteTask.match), mergeMap((action) => {
8
8
  const { taskId } = action.payload;
@@ -14,6 +14,7 @@ export const deleteTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filt
14
14
  if (taskId != null) {
15
15
  actions.push(removeTaskFromList(taskId));
16
16
  }
17
+ actions.push(fetchTaskList());
17
18
  actions.push(deleteTaskSuccessOrFailure({ fetchState: 'Completed', taskId }));
18
19
  return from(actions);
19
20
  }
@@ -4,7 +4,7 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTasks } from '../../../../entity/task/taskReducer';
5
5
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
6
  import { date } from '../../../../zeniDayJS';
7
- import { removeTaskFromList } from '../../taskListView/taskListReducer';
7
+ import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
8
8
  import { snoozeTask, snoozeTaskSuccessOrFailure } from '../taskDetailReducer';
9
9
  export const snoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(snoozeTask.match), mergeMap((action) => handleSnoozeTask(action.payload.taskId, action.payload.snoozedUntil, zeniAPI)));
10
10
  const formatSnoozedUntilForDisplay = (snoozedUntil) => date(snoozedUntil).format('MMM D, h:mm A');
@@ -23,6 +23,7 @@ const handleApiResponse = (response, taskId, snoozedUntil) => {
23
23
  const fetchActions = [
24
24
  updateTasks(response.data.tasks),
25
25
  removeTaskFromList(taskId),
26
+ fetchTaskList(),
26
27
  snoozeTaskSuccessOrFailure({
27
28
  fetchState: 'Completed',
28
29
  taskId,
@@ -3,6 +3,7 @@ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
3
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTasks } from '../../../../entity/task/taskReducer';
5
5
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
+ import { fetchTaskList } from '../../taskListView/taskListReducer';
6
7
  import { snoozeTaskSuccessOrFailure, unsnoozeTask, } from '../taskDetailReducer';
7
8
  export const unsnoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(unsnoozeTask.match), mergeMap((action) => handleUnsnoozeTask(action.payload.taskId, zeniAPI)));
8
9
  const handleUnsnoozeTask = (taskId, zeniAPI) => {
@@ -19,6 +20,7 @@ const handleApiResponse = (response, taskId) => {
19
20
  response.data.tasks.length > 0) {
20
21
  const fetchActions = [
21
22
  updateTasks(response.data.tasks),
23
+ fetchTaskList(),
22
24
  snoozeTaskSuccessOrFailure({
23
25
  fetchState: 'Completed',
24
26
  taskId,
@@ -335,8 +335,15 @@ export const getAllTasks = createSelector((state) => state.taskListState, (state
335
335
  }
336
336
  const { fetchState, error } = reduceAnyFetchState(fetchStateVariables);
337
337
  const taskGroupTemplates = getTaskGroupTemplateByIds(taskGroupTemplateState, taskGroupTemplateViewState.taskGroupTemplateIds);
338
+ const tabCounts = {
339
+ live: taskListState.byTab.live.taskIds.length,
340
+ archived: taskListState.byTab.archived.taskIds.length,
341
+ deleted: taskListState.byTab.deleted.taskIds.length,
342
+ snoozed: taskListState.byTab.snoozed.taskIds.length,
343
+ };
338
344
  return {
339
345
  currentTab: taskListState.currentTab,
346
+ tabCounts,
340
347
  uiState: taskListState.uiState,
341
348
  filters: taskListState.filters,
342
349
  taskGroupTemplates,