@zeniai/client-epic-state 5.1.45-betaDI1 → 5.1.45-betaDI2

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.
@@ -824,26 +824,24 @@ const getGroupedTaskIds = (tasks) => {
824
824
  ...initialTaskIdsByDueDate,
825
825
  };
826
826
  const taskIdsByTags = {};
827
- // Which parents are actually present in this payload. A subtask is
828
- // only treated as "nested" (and dropped from the count / groupings)
829
- // if its parent is in the visible set otherwise it renders as an
830
- // orphan top-level row in the UI (SubtaskDetailTable has no parent to
831
- // attach under) and MUST count. Customer callers routinely see this:
832
- // the parent is Zeni-internal / private and filtered server-side, but
833
- // the subtask itself is public and lands in the payload.
834
- const visibleTaskIds = new Set(tasks.map((t) => t.task_id));
827
+ // A task is a "nested subtask" (hidden from the flat top-level list +
828
+ // dropped from the tab count) iff a parent in the same payload claims
829
+ // it via its `subtasks: [...]` array. Match this criterion exactly to
830
+ // WC's `allSubtaskIds` union in TaskManagementPage.tsx otherwise
831
+ // the tab count and the visible top-level row count disagree
832
+ // whenever the BE emits `parent_task_id` on a subtask but omits it
833
+ // from the parent's `subtasks` array (a real inconsistency this UI
834
+ // sees today).
835
+ //
836
+ // Using `parent_task_id` here would sometimes drop a task from the
837
+ // count that WC still renders as a flat top-level row — that's the
838
+ // bug we're fixing.
839
+ const nestedSubtaskIds = new Set();
835
840
  tasks.forEach((task) => {
836
- // A task is a "nested subtask" only when its parent is in the
837
- // visible payload — otherwise it's an orphan and renders as a
838
- // top-level row in the UI (customer callers routinely see this:
839
- // the parent is Zeni-internal / private and filtered server-side,
840
- // but the subtask itself is public and lands in the payload).
841
- // Datastore string properties default to '' when unset, so treat
842
- // empty string as null. Matches the sibling `updateTasks` guard
843
- // at L719-722.
844
- const isNestedSubtask = task.parent_task_id != null &&
845
- task.parent_task_id !== '' &&
846
- visibleTaskIds.has(task.parent_task_id);
841
+ (task.subtasks ?? []).forEach((subtaskId) => nestedSubtaskIds.add(subtaskId));
842
+ });
843
+ tasks.forEach((task) => {
844
+ const isNestedSubtask = nestedSubtaskIds.has(task.task_id);
847
845
  // Subtasks stay in every groupBy array so the UI can render them
848
846
  // nested under their parent (WC's TaskManagementPage builds
849
847
  // `subtasksByParentId` from `group.tasks` and then filters them
@@ -828,26 +828,24 @@ const getGroupedTaskIds = (tasks) => {
828
828
  ...initialTaskIdsByDueDate,
829
829
  };
830
830
  const taskIdsByTags = {};
831
- // Which parents are actually present in this payload. A subtask is
832
- // only treated as "nested" (and dropped from the count / groupings)
833
- // if its parent is in the visible set otherwise it renders as an
834
- // orphan top-level row in the UI (SubtaskDetailTable has no parent to
835
- // attach under) and MUST count. Customer callers routinely see this:
836
- // the parent is Zeni-internal / private and filtered server-side, but
837
- // the subtask itself is public and lands in the payload.
838
- const visibleTaskIds = new Set(tasks.map((t) => t.task_id));
831
+ // A task is a "nested subtask" (hidden from the flat top-level list +
832
+ // dropped from the tab count) iff a parent in the same payload claims
833
+ // it via its `subtasks: [...]` array. Match this criterion exactly to
834
+ // WC's `allSubtaskIds` union in TaskManagementPage.tsx otherwise
835
+ // the tab count and the visible top-level row count disagree
836
+ // whenever the BE emits `parent_task_id` on a subtask but omits it
837
+ // from the parent's `subtasks` array (a real inconsistency this UI
838
+ // sees today).
839
+ //
840
+ // Using `parent_task_id` here would sometimes drop a task from the
841
+ // count that WC still renders as a flat top-level row — that's the
842
+ // bug we're fixing.
843
+ const nestedSubtaskIds = new Set();
839
844
  tasks.forEach((task) => {
840
- // A task is a "nested subtask" only when its parent is in the
841
- // visible payload — otherwise it's an orphan and renders as a
842
- // top-level row in the UI (customer callers routinely see this:
843
- // the parent is Zeni-internal / private and filtered server-side,
844
- // but the subtask itself is public and lands in the payload).
845
- // Datastore string properties default to '' when unset, so treat
846
- // empty string as null. Matches the sibling `updateTasks` guard
847
- // at L719-722.
848
- const isNestedSubtask = task.parent_task_id != null &&
849
- task.parent_task_id !== '' &&
850
- visibleTaskIds.has(task.parent_task_id);
845
+ (task.subtasks ?? []).forEach((subtaskId) => nestedSubtaskIds.add(subtaskId));
846
+ });
847
+ tasks.forEach((task) => {
848
+ const isNestedSubtask = nestedSubtaskIds.has(task.task_id);
851
849
  // Subtasks stay in every groupBy array so the UI can render them
852
850
  // nested under their parent (WC's TaskManagementPage builds
853
851
  // `subtasksByParentId` from `group.tasks` and then filters them
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.45-betaDI1",
3
+ "version": "5.1.45-betaDI2",
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",