@arrai-innovations/reactive-helpers 2.1.0 → 2.1.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
CHANGED
package/use/listSubscription.js
CHANGED
|
@@ -4,6 +4,7 @@ import { cloneDeep, isEmpty, isObject } from "lodash";
|
|
|
4
4
|
import { assignReactiveObject } from "../utils/assignReactiveObject";
|
|
5
5
|
import inspect from "browser-util-inspect";
|
|
6
6
|
import { useCancellableIntent } from "../utils/cancellableIntent";
|
|
7
|
+
import loadingCombine from "../utils/loadingCombine";
|
|
7
8
|
|
|
8
9
|
export class ListSubscriptionError extends Error {
|
|
9
10
|
constructor(message) {
|
|
@@ -140,7 +141,7 @@ export function useListSubscription({ listInstance, crudArgs, listArgs, retrieve
|
|
|
140
141
|
const es = effectScope();
|
|
141
142
|
|
|
142
143
|
es.run(() => {
|
|
143
|
-
state.loading = computed(() => listInstance.state.loading
|
|
144
|
+
state.loading = computed(() => loadingCombine(listInstance.state.loading, state.subscriptionLoading));
|
|
144
145
|
state.errored = computed(() => listInstance.state.errored || state.subscriptionErrored);
|
|
145
146
|
state.error = computed(() => listInstance.state.error || state.subscriptionError);
|
|
146
147
|
|
|
@@ -3,6 +3,7 @@ import { computed, effectScope, reactive, toRef } from "vue";
|
|
|
3
3
|
import { assignReactiveObject } from "../utils/assignReactiveObject";
|
|
4
4
|
import { useObjectInstance } from "./objectInstance";
|
|
5
5
|
import { useCancellableIntent } from "../utils/cancellableIntent";
|
|
6
|
+
import loadingCombine from "../utils/loadingCombine";
|
|
6
7
|
|
|
7
8
|
export class ObjectSubscriptionError extends Error {
|
|
8
9
|
constructor(message) {
|
|
@@ -149,7 +150,7 @@ export function useObjectSubscription({ objectInstance, crudArgs, id, retrieveAr
|
|
|
149
150
|
const es = effectScope();
|
|
150
151
|
|
|
151
152
|
es.run(() => {
|
|
152
|
-
state.loading = computed(() => objectInstance.state.loading
|
|
153
|
+
state.loading = computed(() => loadingCombine(objectInstance.state.loading, state.subscriptionLoading));
|
|
153
154
|
state.errored = computed(() => objectInstance.state.errored || state.subscriptionErrored);
|
|
154
155
|
state.error = computed(() => objectInstance.state.error || state.subscriptionError);
|
|
155
156
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default function (...loadingStates) {
|
|
2
|
+
// loadingStates is an array of booleans or undefined
|
|
3
|
+
// if any true, return true
|
|
4
|
+
// if all undefined, return undefined
|
|
5
|
+
// otherwise return false (all false)
|
|
6
|
+
if (loadingStates.some((loadingState) => loadingState === true)) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (loadingStates.every((loadingState) => loadingState === undefined)) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|