@arrai-innovations/reactive-helpers 11.4.0 → 11.4.2
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/.circleci/config.yml
CHANGED
|
@@ -7,28 +7,28 @@ orbs:
|
|
|
7
7
|
workflows:
|
|
8
8
|
test:
|
|
9
9
|
jobs:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
- npm/coverage:
|
|
11
|
+
name: tests
|
|
12
|
+
context: arrai-global
|
|
13
|
+
filters:
|
|
14
|
+
branches:
|
|
15
|
+
only:
|
|
16
|
+
- main
|
|
17
|
+
- npm/coverage:
|
|
18
|
+
name: tests-no-badge
|
|
19
|
+
context: arrai-global
|
|
20
|
+
create_badges: false
|
|
21
|
+
filters:
|
|
22
|
+
tags:
|
|
23
|
+
only: /.*/
|
|
24
|
+
branches:
|
|
25
|
+
ignore:
|
|
26
|
+
- main
|
|
27
27
|
- npm/publish:
|
|
28
28
|
name: publish
|
|
29
29
|
context: arrai-private-package-publishing
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
requires:
|
|
31
|
+
- tests-no-badge
|
|
32
32
|
filters:
|
|
33
33
|
tags:
|
|
34
34
|
only: /.*/
|
|
@@ -37,8 +37,8 @@ workflows:
|
|
|
37
37
|
- github/create_release:
|
|
38
38
|
name: release_on_github
|
|
39
39
|
context: arrai-global
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
requires:
|
|
41
|
+
- tests-no-badge
|
|
42
42
|
filters:
|
|
43
43
|
tags:
|
|
44
44
|
only: /.*/
|
package/package.json
CHANGED
|
@@ -593,12 +593,14 @@ describe("use/listInstance.spec.js", function () {
|
|
|
593
593
|
expect(isReadonly(passedIsCancelled)).toBe(true);
|
|
594
594
|
expect(passedIsCancelled.value).toBe(false);
|
|
595
595
|
expect(cancelablePromise.cancel).toBeTruthy();
|
|
596
|
+
expect(listInstance.state.loading).toBe(true);
|
|
596
597
|
|
|
597
598
|
const cancelPromise = cancelablePromise.cancel();
|
|
598
599
|
myListFnCancelResolve();
|
|
599
600
|
await cancelPromise;
|
|
600
601
|
|
|
601
602
|
expect(passedIsCancelled.value).toBe(true);
|
|
603
|
+
expect(listInstance.state.loading).toBe(false);
|
|
602
604
|
});
|
|
603
605
|
});
|
|
604
606
|
});
|
package/use/listCalculated.js
CHANGED
|
@@ -67,10 +67,6 @@ export function useListCalculated({ parentState, calculatedObjectsRules }) {
|
|
|
67
67
|
function calculatedObjectsWatch() {
|
|
68
68
|
const calculatedObjectsRulesIsEmpty = !state.calculatedObjectsRules || isEmpty(state.calculatedObjectsRules);
|
|
69
69
|
for (const objectKey of Object.keys(state.calculatedObjects)) {
|
|
70
|
-
const originalObject = toRef(parentState.objects, objectKey);
|
|
71
|
-
const relatedObject = parentState.relatedObjects
|
|
72
|
-
? toRef(parentState.relatedObjects, objectKey)
|
|
73
|
-
: ref(undefined);
|
|
74
70
|
if (!state.calculatedObjects[objectKey]) {
|
|
75
71
|
state.calculatedObjects[objectKey] = {};
|
|
76
72
|
}
|
|
@@ -96,12 +92,16 @@ export function useListCalculated({ parentState, calculatedObjectsRules }) {
|
|
|
96
92
|
if (!calculatedObjectsEffectScopes[objectKey]) {
|
|
97
93
|
calculatedObjectsEffectScopes[objectKey] = effectScope();
|
|
98
94
|
}
|
|
95
|
+
const originalObjectRef = toRef(parentState.objects, objectKey);
|
|
96
|
+
const relatedObjectRef = parentState.relatedObjects
|
|
97
|
+
? toRef(parentState.relatedObjects, objectKey)
|
|
98
|
+
: ref(undefined);
|
|
99
99
|
calculatedObjectsEffectScopes[objectKey].run(() => {
|
|
100
100
|
for (const addedRuleKey of addedRuleKeys) {
|
|
101
101
|
calculatedObjectsObject[addedRuleKey] = computed(() =>
|
|
102
102
|
state.calculatedObjectsRules?.[addedRuleKey]?.(
|
|
103
|
-
unref(
|
|
104
|
-
unref(
|
|
103
|
+
unref(originalObjectRef),
|
|
104
|
+
unref(relatedObjectRef),
|
|
105
105
|
calculatedObjectsObject
|
|
106
106
|
)
|
|
107
107
|
);
|
package/use/listInstance.js
CHANGED
|
@@ -198,6 +198,7 @@ export function useListInstance({ props, functions = {}, keepOldPages = false })
|
|
|
198
198
|
if (promise) {
|
|
199
199
|
await promise;
|
|
200
200
|
}
|
|
201
|
+
state.loading = false;
|
|
201
202
|
};
|
|
202
203
|
}
|
|
203
204
|
// the indirection of promises here is to allow us to do additional work on listPromise's cancel
|
package/use/listRelated.js
CHANGED
|
@@ -92,8 +92,6 @@ export function useListRelated({ parentState, relatedObjectsRules }) {
|
|
|
92
92
|
function relatedObjectsWatch() {
|
|
93
93
|
const relatedObjectsRulesIsEmpty = !state.relatedObjectsRules || isEmpty(state.relatedObjectsRules);
|
|
94
94
|
for (const objectKey of Object.keys(state.relatedObjects)) {
|
|
95
|
-
const originalObjectRef = toRef(parentState.objects, objectKey);
|
|
96
|
-
const relatedObjectRef = toRef(state.relatedObjects, objectKey);
|
|
97
95
|
let removedRuleKeys, addedRuleKeys;
|
|
98
96
|
if (!relatedObjectsRulesIsEmpty) {
|
|
99
97
|
({ removedKeys: removedRuleKeys, addedKeys: addedRuleKeys } = keyDiff(
|
|
@@ -119,6 +117,8 @@ export function useListRelated({ parentState, relatedObjectsRules }) {
|
|
|
119
117
|
if (!relatedObjectsEffectScopes[objectKey]) {
|
|
120
118
|
relatedObjectsEffectScopes[objectKey] = effectScope();
|
|
121
119
|
}
|
|
120
|
+
const originalObjectRef = toRef(parentState.objects, objectKey);
|
|
121
|
+
const relatedObjectRef = toRef(state.relatedObjects, objectKey);
|
|
122
122
|
relatedObjectsEffectScopes[objectKey].run(() => {
|
|
123
123
|
for (const addedRuleKey of addedRuleKeys) {
|
|
124
124
|
const rules = toRef(state.relatedObjectsRules, addedRuleKey);
|
package/use/objectRelated.js
CHANGED
|
@@ -79,7 +79,6 @@ export function useObjectRelated({ parentState, relatedObjectRules }) {
|
|
|
79
79
|
// deal with computed objects being passed.
|
|
80
80
|
const ruleObjects = unref(state.relatedObjectRules?.[addedRuleKey]?.objects);
|
|
81
81
|
const rulePkKey = state.relatedObjectRules?.[addedRuleKey]?.pkKey || addedRuleKey;
|
|
82
|
-
const ruleOrder = unref(state.relatedObjectRules?.[addedRuleKey]?.order);
|
|
83
82
|
if (!ruleObjects || !rulePkKey) {
|
|
84
83
|
state.relatedObject[addedRuleKey] = undefined;
|
|
85
84
|
return;
|
|
@@ -90,6 +89,7 @@ export function useObjectRelated({ parentState, relatedObjectRules }) {
|
|
|
90
89
|
return;
|
|
91
90
|
}
|
|
92
91
|
if (isArray(value)) {
|
|
92
|
+
const ruleOrder = unref(state.relatedObjectRules?.[addedRuleKey]?.order);
|
|
93
93
|
// the related list could be sorted differently than the original list.
|
|
94
94
|
if (ruleOrder?.length) {
|
|
95
95
|
value = value.filter(identity);
|
package/utils/debugMessage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isSuperset } from "./set.js";
|
|
2
2
|
import { transformWalk } from "./transformWalk.js";
|
|
3
|
-
import debounce from "lodash-es/debounce";
|
|
3
|
+
import debounce from "lodash-es/debounce.js";
|
|
4
4
|
import isSet from "lodash-es/isSet.js";
|
|
5
5
|
import partial from "lodash-es/partial.js";
|
|
6
6
|
import union from "lodash-es/union.js";
|