Skip to content

Commit b1e1955

Browse files
authored
fix: revert SubjectUnsubscribedChecker (#194)
1 parent 1328bfe commit b1e1955

File tree

6 files changed

+2
-244
lines changed

6 files changed

+2
-244
lines changed

apps/integration/src/app/inheritance/inheritance.component.html

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,13 @@
1111
with `@UntilDestroy()` but directive is not
1212
</li>
1313
<li>
14-
`Issue97Component` extends from `Issue97Directive`. Directive is decorated with
14+
`Issue97Component` extends from the `Issue97Directive`. Directive is decorated with
1515
`@UntilDestroy()` but component is not
1616
</li>
17-
<li>
18-
`Issue175Component` extends from the `Issue175Directive`. Directive is decorated with
19-
`@UntilDestroy()` and the `Issue175Component` implements its own `ngOnDestroy()`
20-
method. The `Issue175Directive.ngOnDestroy()` will not be called, because
21-
`Issue175Component.ngOnDestroy()` does not call `super.ngOnDestroy()`.
22-
</li>
2317
</ol>
2418

2519
<app-issue-61 *ngIf="issue61Shown"></app-issue-61>
2620
<app-issue-97 *ngIf="issue97Shown"></app-issue-97>
27-
<app-issue-175 *ngIf="issue175Shown"></app-issue-175>
2821

2922
<div data-cy="issue-61-status" [class]="issue61StatusClass$ | async">
3023
Issue#61: {{ issue61StatusText$ | async }}
@@ -33,10 +26,6 @@
3326
<div data-cy="issue-97-status" [class]="issue97StatusClass$ | async">
3427
Issue#97: {{ issue97StatusText$ | async }}
3528
</div>
36-
37-
<div data-cy="issue-175-status" [class]="issue175StatusClass$ | async">
38-
Issue#175: {{ issue175StatusText$ | async }}
39-
</div>
4029
</div>
4130
</div>
4231

@@ -46,11 +35,4 @@
4635
<button data-cy="toggle-issue-97" class="button is-link is-light" (click)="toggleIssue97()">
4736
Toggle issue#97
4837
</button>
49-
<button
50-
data-cy="toggle-issue-175"
51-
class="button is-link is-light"
52-
(click)="toggleIssue175()"
53-
>
54-
Toggle issue#175
55-
</button>
5638
</div>

apps/integration/src/app/inheritance/inheritance.component.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { NotificationClass, NotificationText } from '../enums/notification.enum'
1212
export class InheritanceComponent {
1313
issue61Shown = true;
1414
issue97Shown = true;
15-
issue175Shown = true;
1615

1716
issue61Status$ = new BehaviorSubject({
1817
directiveUnsubscribed: false,
@@ -55,29 +54,11 @@ export class InheritanceComponent {
5554
)
5655
);
5756

58-
issue175Status$ = new BehaviorSubject({ componentUnsubscribed: false });
59-
60-
issue175StatusClass$ = this.issue175Status$.pipe(
61-
map(({ componentUnsubscribed }) =>
62-
componentUnsubscribed ? NotificationClass.Success : NotificationClass.Danger
63-
)
64-
);
65-
66-
issue175StatusText$ = this.issue175Status$.pipe(
67-
map(({ componentUnsubscribed }) =>
68-
componentUnsubscribed ? NotificationText.Unsubscribed : NotificationText.Subscribed
69-
)
70-
);
71-
7257
toggleIssue61(): void {
7358
this.issue61Shown = !this.issue61Shown;
7459
}
7560

7661
toggleIssue97(): void {
7762
this.issue97Shown = !this.issue97Shown;
7863
}
79-
80-
toggleIssue175(): void {
81-
this.issue175Shown = !this.issue175Shown;
82-
}
8364
}

apps/integration/src/app/inheritance/inheritance.module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { InheritanceComponent } from './inheritance.component';
66

77
import { Issue61Component } from './issue-61/issue-61.component';
88
import { Issue97Component } from './issue-97/issue-97.component';
9-
import { Issue175Component } from './issue-175/issue-175.component';
109

1110
@NgModule({
1211
imports: [
@@ -18,6 +17,6 @@ import { Issue175Component } from './issue-175/issue-175.component';
1817
},
1918
]),
2019
],
21-
declarations: [InheritanceComponent, Issue61Component, Issue97Component, Issue175Component],
20+
declarations: [InheritanceComponent, Issue61Component, Issue97Component],
2221
})
2322
export class InheritanceModule {}

apps/integration/src/app/inheritance/issue-175/issue-175.component.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

libs/until-destroy/src/lib/checker.ts

Lines changed: 0 additions & 171 deletions
This file was deleted.

libs/until-destroy/src/lib/until-destroy.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ import {
66
import { Subscription } from 'rxjs';
77

88
import { PipeType, isPipe } from './ivy';
9-
import { createSubjectUnsubscribedChecker } from './checker';
109
import {
1110
getSymbol,
1211
UntilDestroyOptions,
1312
completeSubjectOnTheInstance,
1413
markAsDecorated,
1514
} from './internals';
1615

17-
// This will be provided through Terser global definitions by Angular CLI. This will
18-
// help to tree-shake away the code unneeded for production bundles.
19-
declare const ngDevMode: boolean;
20-
2116
function unsubscribe(property: unknown): void {
2217
if (property instanceof Subscription) {
2318
property.unsubscribe();
@@ -71,9 +66,6 @@ function decoratePipe<T>(type: PipeType<T>, options: UntilDestroyOptions): void
7166
}
7267

7368
export function UntilDestroy(options: UntilDestroyOptions = {}): ClassDecorator {
74-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
75-
// @ts-ignore The TS compiler throws 'typeof SubjectUnsubscribedChecker' is assignable to the constraint of type
76-
// 'TFunction', but 'TFunction' could be instantiated with a different subtype of constraint 'Function'.
7769
return (type: any) => {
7870
if (isPipe(type)) {
7971
decoratePipe(type, options);
@@ -82,9 +74,5 @@ export function UntilDestroy(options: UntilDestroyOptions = {}): ClassDecorator
8274
}
8375

8476
markAsDecorated(type);
85-
86-
if (ngDevMode) {
87-
return createSubjectUnsubscribedChecker(type);
88-
}
8977
};
9078
}

0 commit comments

Comments
 (0)