@arrai-innovations/reactive-helpers 9.0.0 → 9.0.1
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 +1 -1
- package/use/cancellableIntent.js +4 -3
package/package.json
CHANGED
package/use/cancellableIntent.js
CHANGED
|
@@ -87,13 +87,14 @@ export function useCancellableIntent({
|
|
|
87
87
|
|
|
88
88
|
const intentWatch = async () => {
|
|
89
89
|
let newWatchValues = deepUnref(Object.values(watchArguments));
|
|
90
|
-
const guardValues = deepUnref(Object.values(guardArguments));
|
|
91
90
|
if (isEqual(newWatchValues, previousWatchValues)) {
|
|
92
91
|
return;
|
|
93
92
|
}
|
|
94
93
|
previousWatchValues = newWatchValues;
|
|
95
|
-
await cancel();
|
|
96
|
-
|
|
94
|
+
await cancel(); // this can take time so guards and watches can change!
|
|
95
|
+
newWatchValues = deepUnref(Object.values(watchArguments));
|
|
96
|
+
const guardValues = deepUnref(Object.values(guardArguments));
|
|
97
|
+
if (Object.values(newWatchValues).every(identity)) {
|
|
97
98
|
// if any guards are true, delay the watch.
|
|
98
99
|
if (guardValues && !isEmpty(guardValues) && guardValues.some(identity)) {
|
|
99
100
|
delayedWatch = doIntentWatch;
|