ywana-core8 0.1.1 → 0.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.1.001",
3
+ "version": "0.1.4",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -36,12 +36,20 @@ export const TaskContextProvider = (props) => {
36
36
  for (let i = 0; i < taskIDs.length; i++) {
37
37
  const taskID = taskIDs[i]
38
38
  const tsk = await task(taskID)
39
+
39
40
  if (!tsk) {
40
41
  console.log("Task not found", taskID)
41
42
  removeListener(taskID)
42
43
  console.log("Listener removed", taskID)
43
44
  continue
44
45
  }
46
+
47
+ if (tsk.state === "COMPLETED" || tsk.state === "FAULTED" || tsk.state === "CANCELED") {
48
+ console.log("Task finished", taskID, task.state)
49
+ removeListener(taskID)
50
+ console.log("Listener removed", taskID)
51
+ }
52
+
45
53
  const listener = listeners[taskID]
46
54
  if (listener) listener(tsk, appContextRef.current)
47
55
  }
@@ -87,6 +95,7 @@ export const TaskContextProvider = (props) => {
87
95
  async function removeTask(task) {
88
96
  try {
89
97
  const response = await API.remove(task.id);
98
+ removeListener(task.id)
90
99
  return response;
91
100
  } catch (error) {
92
101
  console.log("removeTask error", error);