@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.
@@ -220,7 +220,12 @@ const taskList = (0, toolkit_1.createSlice)({
220
220
  const { taskIds, groupId } = action.payload;
221
221
  draft.updateTasksFetchState.fetchState = 'Completed';
222
222
  draft.updateTasksFetchState.error = undefined;
223
- if (groupId != null) {
223
+ if (groupId == null) {
224
+ // Tab-changing operations (archive/delete/unarchive/undo-delete/unsnooze):
225
+ // Remove affected tasks from the current tab's top-level indices
226
+ removeTaskIdsFromTopLevel(draft, taskIds);
227
+ }
228
+ else if (groupId != null) {
224
229
  const { groupByKey } = draft.uiState;
225
230
  if (groupByKey === 'groupName') {
226
231
  Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
@@ -543,6 +548,28 @@ const getTagsGroupKey = (tags) => {
543
548
  tagIds.sort();
544
549
  return tagIds.join(',');
545
550
  };
551
+ const removeTaskIdsFromTopLevel = (draft, taskIds) => {
552
+ const isRemoved = (id) => taskIds.includes(id);
553
+ draft.taskIds = draft.taskIds.filter((id) => !isRemoved(id));
554
+ Object.keys(draft.taskIdsByGroupsIds).forEach((gId) => {
555
+ draft.taskIdsByGroupsIds[gId] = draft.taskIdsByGroupsIds[gId].filter((id) => !isRemoved(id));
556
+ });
557
+ Object.keys(draft.taskIdsByPriority).forEach((key) => {
558
+ draft.taskIdsByPriority[key] = draft.taskIdsByPriority[key].filter((id) => !isRemoved(id));
559
+ });
560
+ Object.keys(draft.taskIdsByStatus).forEach((key) => {
561
+ draft.taskIdsByStatus[key] = draft.taskIdsByStatus[key].filter((id) => !isRemoved(id));
562
+ });
563
+ Object.keys(draft.taskIdsByDueDate).forEach((key) => {
564
+ draft.taskIdsByDueDate[key] = draft.taskIdsByDueDate[key].filter((id) => !isRemoved(id));
565
+ });
566
+ Object.keys(draft.taskIdsByAssignees).forEach((key) => {
567
+ draft.taskIdsByAssignees[key] = draft.taskIdsByAssignees[key].filter((id) => !isRemoved(id));
568
+ });
569
+ Object.keys(draft.taskIdsByTags).forEach((key) => {
570
+ draft.taskIdsByTags[key] = draft.taskIdsByTags[key].filter((id) => !isRemoved(id));
571
+ });
572
+ };
546
573
  const toTabData = (grouped) => ({
547
574
  taskIds: grouped.taskIds,
548
575
  taskIdsByAssignees: grouped.taskIdsByAssignees,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.20.2-beta28RR",
3
+ "version": "4.20.2-beta29RR",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",