chayns-api 2.2.19 → 2.2.20

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.
@@ -21,9 +21,9 @@ const WaitUntil = ({
21
21
  loadingComponent
22
22
  }) => {
23
23
  const [loaded, setLoaded] = (0, _react.useState)(() => !tasks.length);
24
- const mounted = (0, _react.useRef)(false);
25
- if (!mounted.current) handleTasks(tasks).finally(() => setLoaded(true));
26
- mounted.current = true;
24
+ (0, _react.useEffect)(() => {
25
+ handleTasks(tasks).finally(() => setLoaded(true));
26
+ }, []);
27
27
  return loaded ? children : loadingComponent;
28
28
  };
29
29
  exports.WaitUntil = WaitUntil;
@@ -1,4 +1,4 @@
1
- import { useRef, useState } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  const handleTasks = async tasks => {
3
3
  for (let i = 0; i < tasks.length; i++) {
4
4
  const task = tasks[i];
@@ -16,8 +16,8 @@ export const WaitUntil = _ref => {
16
16
  loadingComponent
17
17
  } = _ref;
18
18
  const [loaded, setLoaded] = useState(() => !tasks.length);
19
- const mounted = useRef(false);
20
- if (!mounted.current) handleTasks(tasks).finally(() => setLoaded(true));
21
- mounted.current = true;
19
+ useEffect(() => {
20
+ handleTasks(tasks).finally(() => setLoaded(true));
21
+ }, []);
22
22
  return loaded ? children : loadingComponent;
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.2.19",
3
+ "version": "2.2.20",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",