Skip to content

Commit 135308c

Browse files
committed
Merge branch 'main' into test/make-rx-for-stable
2 parents c50570c + 2e94f9d commit 135308c

File tree

13 files changed

+49
-43
lines changed

13 files changed

+49
-43
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Find details in the linked readme files below for installation and setup instruc
7171

7272
| Angular | RxJS | @rx-angular/state | @rx-angular/template | @rx-angular/cdk |
7373
|------------------------|----------------------|-------------------|----------------------|---------------------|
74+
| `14` | `^7.4.0` | `> 1.4.6` | `> 1.0.0-beta.29` | `> 1.0.0-alpha.10` |
7475
| `^12.0.0` or `^13.0.0` | `^6.5.5` or `^7.4.0` | `> 1.4.6` | `> 1.0.0-beta.29` | `> 1.0.0-alpha.10` |
7576
| `^11.0.0` | `^6.5.5` | `<= 1.4.6` | `<= 1.0.0-beta.29` | `<= 1.0.0-alpha.10` |
7677

libs/cdk/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ nx migrate @rx-angular/cdk
5252

5353
| Angular | RxJS | @rx-angular/cdk |
5454
|------------------------|----------------------|---------------------|
55+
| `14` | `^7.4.0` | `> 1.0.0-alpha.10` |
5556
| `^12.0.0` or `^13.0.0` | `^6.5.5` or `^7.4.0` | `> 1.0.0-alpha.10` |
5657
| `^11.0.0` | `^6.5.5` | `<= 1.0.0-alpha.10` |
5758

libs/state/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ nx migrate @rx-angular/state
141141

142142
| Angular | RxJS | @rx-angular/state |
143143
|------------------------|----------------------|-------------------|
144+
| `14` | `^7.4.0` | `> 1.4.6` |
144145
| `^12.0.0` or `^13.0.0` | `^6.5.5` or `^7.4.0` | `> 1.4.6` |
145146
| `^11.0.0` | `^6.5.5` | `<= 1.4.6` |
146147

libs/state/docs/snippets/loading-state-and-data-fetching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class MyComponent {
2929
tap(() => this.isLoading$.next(false)),
3030
);
3131

32-
this.subscription = this.fetchUserOnUrlChangeEffect$
32+
this.subscription = fetchUserOnUrlChangeEffect$
3333
.subscribe();
3434

3535
}

libs/state/effects/src/lib/effects.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ import {
77
PartialObserver,
88
pipe,
99
Subject,
10-
Subscription,
10+
Subscription
11+
} from 'rxjs';
12+
import {
1113
catchError,
1214
filter,
1315
mapTo,
1416
mergeAll,
17+
share,
1518
takeUntil,
16-
tap, share
17-
} from 'rxjs';
19+
tap
20+
} from 'rxjs/operators';
1821
import { DestroyProp, OnDestroy$ } from './model';
1922
import { toHook, untilDestroyed } from './utils';
2023

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export { CompareFn } from './compare-fn';
22
export { KeyCompareMap } from './key-compare-map';
3+
export { NonUndefined } from './non-undefined';
34
export { PickSlice } from './pick-slice';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type NonUndefined<T> = T extends undefined ? never : T;

libs/state/selections/src/lib/operators/stateful.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { MonoTypeOperatorFunction, Observable, OperatorFunction } from 'rxjs';
1+
import { Observable, OperatorFunction } from 'rxjs';
22
import { distinctUntilChanged, filter, shareReplay } from 'rxjs/operators';
3+
import { NonUndefined } from '../interfaces';
34
import { isOperateFnArrayGuard } from '../utils/guards';
45
import { pipeFromArray } from '../utils/pipe-from-array';
56

@@ -39,33 +40,33 @@ import { pipeFromArray } from '../utils/pipe-from-array';
3940
* );
4041
*
4142
* @param {OperatorFunction<T, A>} op - one or multiple passed operator comma separated
42-
* @return OperatorFunction<T, A>
43+
* @return OperatorFunction<T, NonUndefined<A>>
4344
*
4445
* @docsPage stateful
4546
* @docsCategory operators
4647
*/
47-
export function stateful<T>(): MonoTypeOperatorFunction<T>;
48+
export function stateful<T>(): OperatorFunction<T, NonUndefined<T>>;
4849
/**
4950
* @internal
5051
*/
5152
export function stateful<T, A>(
5253
op: OperatorFunction<T, A>
53-
): OperatorFunction<T, A>;
54+
): OperatorFunction<T, NonUndefined<A>>;
5455
/**
5556
* @internal
5657
*/
5758
export function stateful<T, A, B>(
5859
op1: OperatorFunction<T, A>,
5960
op2: OperatorFunction<A, B>
60-
): OperatorFunction<T, B>;
61+
): OperatorFunction<T, NonUndefined<B>>;
6162
/**
6263
* @internal
6364
*/
6465
export function stateful<T, A, B, C>(
6566
op1: OperatorFunction<T, A>,
6667
op2: OperatorFunction<A, B>,
6768
op3: OperatorFunction<B, C>
68-
): OperatorFunction<T, C>;
69+
): OperatorFunction<T, NonUndefined<C>>;
6970
/**
7071
* @internal
7172
*/
@@ -74,7 +75,7 @@ export function stateful<T, A, B, C, D>(
7475
op2: OperatorFunction<A, B>,
7576
op3: OperatorFunction<B, C>,
7677
op4: OperatorFunction<C, D>
77-
): OperatorFunction<T, D>;
78+
): OperatorFunction<T, NonUndefined<D>>;
7879
/**
7980
* @internal
8081
*/
@@ -84,7 +85,7 @@ export function stateful<T, A, B, C, D, E>(
8485
op3: OperatorFunction<B, C>,
8586
op4: OperatorFunction<C, D>,
8687
op5: OperatorFunction<D, E>
87-
): OperatorFunction<T, E>;
88+
): OperatorFunction<T, NonUndefined<E>>;
8889
/**
8990
* @description
9091
*
@@ -110,8 +111,8 @@ export function stateful<T, A, B, C, D, E>(
110111
*/
111112
export function stateful<T, R>(
112113
...optionalDerive: OperatorFunction<T, R>[]
113-
): OperatorFunction<T, T | R> {
114-
return (s: Observable<T>): Observable<T | R> => {
114+
): OperatorFunction<T, NonUndefined<T> | NonUndefined<R>> {
115+
return (s: Observable<T>): Observable<NonUndefined<T> | NonUndefined<R>> => {
115116
return s.pipe(
116117
// distinct same base-state objects (e.g. a default emission of default switch cases, incorrect mutable handling
117118
// of data) @TODO evaluate benefits vs. overhead
@@ -124,7 +125,7 @@ export function stateful<T, R>(
124125
return o;
125126
},
126127
// initial emissions, undefined is no base-state, pollution with skip(1)
127-
filter((v) => v !== undefined),
128+
filter((v): v is NonUndefined<typeof v> => v !== undefined),
128129
// distinct same derivation value
129130
distinctUntilChanged(),
130131
// reuse custom operations result for multiple subscribers and reemit the last calculated value.

libs/template/.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"style": "kebab-case"
4242
}
4343
],
44+
"@angular-eslint/no-input-rename": "off",
4445
"@typescript-eslint/no-non-null-assertion": "warn"
4546
}
4647
},

libs/template/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ on template rendering, the coordination and optimization of `ChangeDetection` cy
2525
straight **drop in replacement** for the `AsyncPipe (async)`, the `LetDirective` will often provide a more
2626
convenient way of managing reactive sources and lazy rendering of the view.
2727

28+
Should be noted that both [LetDirective (`*rxLet`)](https://github.com/rx-angular/rx-angular/tree/main/libs/template/docs/api/let-directive.md) &
29+
[PushPipe (`push`)](https://github.com/rx-angular/rx-angular/tree/main/libs/template/docs/push.md) recognize only immutable changes.
30+
2831
Using those with the default strategy ([Local Strategy](https://github.com/rx-angular/rx-angular/blob/main/libs/cdk/docs/render-strategies/strategies.md#local)) should already improve the rendering performance of
2932
your application by a decent amount.
3033

@@ -111,6 +114,7 @@ about what changes are leading to re-renderings.
111114

112115
| Angular | RxJS | @rx-angular/template |
113116
|------------------------|----------------------|----------------------|
117+
| `14` | `^7.4.0` | `> 1.0.0-beta.29` |
114118
| `^12.0.0` or `^13.0.0` | `^6.5.5` or `^7.4.0` | `> 1.0.0-beta.29` |
115119
| `^11.0.0` | `^6.5.5` | `<= 1.0.0-beta.29` |
116120

0 commit comments

Comments
 (0)