prostgles-client 4.0.298 → 4.0.299
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAsyncEffectQueue.d.ts","sourceRoot":"","sources":["../../lib/hooks/useAsyncEffectQueue.ts"],"names":[],"mappings":"AAKA,KAAK,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AAQrD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAY,UAAU,QAAQ,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"useAsyncEffectQueue.d.ts","sourceRoot":"","sources":["../../lib/hooks/useAsyncEffectQueue.ts"],"names":[],"mappings":"AAKA,KAAK,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;AAQrD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAY,UAAU,QAAQ,GAAG,EAAE,SA8DlE,CAAC"}
|
|
@@ -12,6 +12,14 @@ const useAsyncEffectQueue = (effect, deps) => {
|
|
|
12
12
|
const isMounted = (0, reactImports_1.useRef)(true);
|
|
13
13
|
const newEffect = (0, reactImports_1.useRef)();
|
|
14
14
|
const activeEffect = (0, reactImports_1.useRef)();
|
|
15
|
+
const timerRef = (0, reactImports_1.useRef)(null);
|
|
16
|
+
const scheduleRender = () => {
|
|
17
|
+
if (timerRef.current)
|
|
18
|
+
clearTimeout(timerRef.current);
|
|
19
|
+
timerRef.current = setTimeout(() => {
|
|
20
|
+
onRender();
|
|
21
|
+
}, 80);
|
|
22
|
+
};
|
|
15
23
|
const onRender = async () => {
|
|
16
24
|
var _a, _b;
|
|
17
25
|
/**
|
|
@@ -52,10 +60,10 @@ const useAsyncEffectQueue = (effect, deps) => {
|
|
|
52
60
|
(0, useEffectDeep_1.useEffectDeep)(() => {
|
|
53
61
|
isMounted.current = true;
|
|
54
62
|
newEffect.current = { effect, deps, id: ++idRef.current };
|
|
55
|
-
|
|
63
|
+
scheduleRender();
|
|
56
64
|
return () => {
|
|
57
65
|
isMounted.current = false;
|
|
58
|
-
|
|
66
|
+
scheduleRender();
|
|
59
67
|
};
|
|
60
68
|
}, deps);
|
|
61
69
|
};
|