Skip to content

Commit

Permalink
LSC cl/683332949 - Move initializers into constructors. (#6927)
Browse files Browse the repository at this point in the history
Move the initializer into the constructor for instance members that
reference identifiers declared in the constructor.

Googlers, see cl/683332949 for more details.
  • Loading branch information
arcra authored Oct 17, 2024
1 parent b2ab51a commit 109771f
Show file tree
Hide file tree
Showing 12 changed files with 662 additions and 579 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,23 @@ import {State} from './store/debugger_types';
],
})
export class DebuggerContainer implements OnInit, OnDestroy {
readonly runs$ = this.store.pipe(select(getDebuggerRunListing));
readonly runs$;

readonly runsIds$ = this.store.pipe(
select(
createSelector(getDebuggerRunListing, (runs): string[] =>
Object.keys(runs)
)
)
);
readonly runsIds$;

readonly activeRunId$ = this.store.pipe(select(getActiveRunId));
readonly activeRunId$;

constructor(private readonly store: Store<State>) {}
constructor(private readonly store: Store<State>) {
this.runs$ = this.store.pipe(select(getDebuggerRunListing));
this.runsIds$ = this.store.pipe(
select(
createSelector(getDebuggerRunListing, (runs): string[] =>
Object.keys(runs)
)
)
);
this.activeRunId$ = this.store.pipe(select(getActiveRunId));
}

ngOnInit(): void {
this.store.dispatch(debuggerLoaded());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,31 @@ const ALERT_TYPE_TO_DISPLAY_NAME_AND_SYMBOL: {
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AlertsContainer {
readonly numAlerts$ = this.store.pipe(select(getNumAlerts));
readonly numAlerts$;

readonly alertsBreakdown$ = this.store.pipe(
select(
createSelector(getAlertsBreakdown, (alertsBreakdown) => {
const alertTypes = Object.keys(alertsBreakdown);
alertTypes.sort();
return alertTypes.map((alertType): AlertTypeDisplay => {
return {
type: alertType as AlertType,
...ALERT_TYPE_TO_DISPLAY_NAME_AND_SYMBOL[alertType],
count: alertsBreakdown[alertType],
};
});
})
)
);
readonly alertsBreakdown$;

readonly focusType$ = this.store.pipe(select(getAlertsFocusType));
readonly focusType$;

constructor(private readonly store: Store<State>) {}
constructor(private readonly store: Store<State>) {
this.numAlerts$ = this.store.pipe(select(getNumAlerts));
this.alertsBreakdown$ = this.store.pipe(
select(
createSelector(getAlertsBreakdown, (alertsBreakdown) => {
const alertTypes = Object.keys(alertsBreakdown);
alertTypes.sort();
return alertTypes.map((alertType): AlertTypeDisplay => {
return {
type: alertType as AlertType,
...ALERT_TYPE_TO_DISPLAY_NAME_AND_SYMBOL[alertType],
count: alertsBreakdown[alertType],
};
});
})
)
);
this.focusType$ = this.store.pipe(select(getAlertsFocusType));
}

onToggleFocusType(alertType: AlertType) {
this.store.dispatch(alertTypeFocusToggled({alertType}));
Expand Down
Loading

0 comments on commit 109771f

Please sign in to comment.