@zeniai/client-epic-state 4.20.2-beta28RR → 4.20.2-beta29RR

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.
@@ -216,7 +216,12 @@ const taskList = createSlice({
216
216
  const { taskIds, groupId } = action.payload;
217
217
  draft.updateTasksFetchState.fetchState = 'Completed';
218
218
  draft.updateTasksFetchState.error = undefined;
219
- if (groupId != null) {
219
+ if (groupId == null) {
220
+ // Tab-changing operations (archive/delete/unarchive/undo-delete/unsnooze):
221
+ // Remove affected tasks from the current tab's top-level indices
222
+ removeTaskIdsFromTopLevel(draft, taskIds);
223
+ }
224
+ else if (groupId != null) {
220
225
  const { groupByKey } = draft.uiState;
221
226
  if (groupByKey === 'groupName') {
222
227
  Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
@@ -539,6 +544,28 @@ const getTagsGroupKey = (tags) => {
539
544
  tagIds.sort();
540
545
  return tagIds.join(',');
541
546
  };
547
+ const removeTaskIdsFromTopLevel = (draft, taskIds) => {
548
+ const isRemoved = (id) => taskIds.includes(id);
549
+ draft.taskIds = draft.taskIds.filter((id) => !isRemoved(id));
550
+ Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
551
+ draft.taskIdsByGroupsIds[gId] = draft.taskIdsByGroupsIds[gId].filter((id) => !isRemoved(id));
552
+ });
553
+ Object.keys(draft.taskIdsByPriority).forEach((key) => {
554
+ draft.taskIdsByPriority[key] = draft.taskIdsByPriority[key].filter((id) => !isRemoved(id));
555
+ });
556
+ Object.keys(draft.taskIdsByStatus).forEach((key) => {
557
+ draft.taskIdsByStatus[key] = draft.taskIdsByStatus[key].filter((id) => !isRemoved(id));
558
+ });
559
+ Object.keys(draft.taskIdsByDueDate).forEach((key) => {
560
+ draft.taskIdsByDueDate[key] = draft.taskIdsByDueDate[key].filter((id) => !isRemoved(id));
561
+ });
562
+ Object.keys(draft.taskIdsByAssignees).forEach((key) => {
563
+ draft.taskIdsByAssignees[key] = draft.taskIdsByAssignees[key].filter((id) => !isRemoved(id));
564
+ });
565
+ Object.keys(draft.taskIdsByTags).forEach((key) => {
566
+ draft.taskIdsByTags[key] = draft.taskIdsByTags[key].filter((id) => !isRemoved(id));
567
+ });
568
+ };
542
569
  const toTabData = (grouped) => ({
543
570
  taskIds: grouped.taskIds,
544
571
  taskIdsByAssignees: grouped.taskIdsByAssignees,