@cascateer/core 2.1.27 → 2.1.29
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/src/api.ts +5 -7
- package/src/types.ts +11 -9
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
intersectionWith,
|
|
5
5
|
isEqual,
|
|
6
6
|
isFunction,
|
|
7
|
+
memoize,
|
|
7
8
|
} from "lodash";
|
|
9
|
+
import objectHash from "object-hash";
|
|
8
10
|
import {
|
|
9
11
|
combineLatest,
|
|
10
12
|
filter,
|
|
@@ -19,12 +21,7 @@ import {
|
|
|
19
21
|
tap,
|
|
20
22
|
UnaryFunction,
|
|
21
23
|
} from "rxjs";
|
|
22
|
-
import {
|
|
23
|
-
asObservable,
|
|
24
|
-
ExtendableDictionary,
|
|
25
|
-
memoizeHashed,
|
|
26
|
-
property,
|
|
27
|
-
} from "./lib";
|
|
24
|
+
import { asObservable, ExtendableDictionary, property } from "./lib";
|
|
28
25
|
import { ProxyObservable } from "./observable";
|
|
29
26
|
import { Action, MaybeArray, MaybeObservable, ProxyEffect } from "./types";
|
|
30
27
|
|
|
@@ -51,7 +48,7 @@ class Memoizable<Args, Result> {
|
|
|
51
48
|
this.tags = isFunction(tags) ? tags : constant([tags ?? []].flat());
|
|
52
49
|
|
|
53
50
|
this.subscribe = (invalidatedTags) => {
|
|
54
|
-
const memoizedEffect: ProxyEffect<Args, Result> =
|
|
51
|
+
const memoizedEffect: ProxyEffect<Args, Result> = memoize(
|
|
55
52
|
(args) =>
|
|
56
53
|
new ProxyObservable((pending) =>
|
|
57
54
|
this.predicate(args).pipe(
|
|
@@ -75,6 +72,7 @@ class Memoizable<Args, Result> {
|
|
|
75
72
|
shareReplay({ bufferSize: 1, refCount: false }),
|
|
76
73
|
),
|
|
77
74
|
),
|
|
75
|
+
(args) => objectHash(args ?? null),
|
|
78
76
|
);
|
|
79
77
|
|
|
80
78
|
return memoizedEffect;
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Dictionary, mapValues, tap } from "lodash";
|
|
1
|
+
import { Dictionary, mapValues, memoize, tap } from "lodash";
|
|
2
|
+
import objectHash from "object-hash";
|
|
2
3
|
import {
|
|
3
4
|
combineLatest,
|
|
4
5
|
distinct,
|
|
@@ -9,7 +10,6 @@ import {
|
|
|
9
10
|
} from "rxjs";
|
|
10
11
|
import { Observable } from "rxjs/internal/Observable";
|
|
11
12
|
import { ObservableInput } from "rxjs/internal/types";
|
|
12
|
-
import { memoizeHashed } from "./lib";
|
|
13
13
|
import { ProxyObservable } from "./observable";
|
|
14
14
|
import { concat } from "./operators";
|
|
15
15
|
|
|
@@ -43,15 +43,17 @@ export class ProxyEffectInterceptor extends ReplaySubject<
|
|
|
43
43
|
effects: Effects,
|
|
44
44
|
): ProxyEffects<Effects> {
|
|
45
45
|
return mapValues(effects, (effect) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
memoize(
|
|
47
|
+
(args) =>
|
|
48
|
+
tap(
|
|
49
|
+
new ProxyObservable(effect(args), (target) =>
|
|
50
|
+
combineLatest([target.pending, target.refCount]).pipe(
|
|
51
|
+
map((values) => values.every(Boolean)),
|
|
52
|
+
),
|
|
51
53
|
),
|
|
54
|
+
(source) => this.next(source),
|
|
52
55
|
),
|
|
53
|
-
|
|
54
|
-
),
|
|
56
|
+
(args) => objectHash(args ?? null),
|
|
55
57
|
),
|
|
56
58
|
);
|
|
57
59
|
}
|