Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 109771f

Browse files
authored
LSC cl/683332949 - Move initializers into constructors. (#6927)
Move the initializer into the constructor for instance members that reference identifiers declared in the constructor. Googlers, see cl/683332949 for more details.
1 parent b2ab51a commit 109771f

File tree

12 files changed

+662
-579
lines changed

12 files changed

+662
-579
lines changed

tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/debugger_container.ts

+14-10
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,23 @@ import {State} from './store/debugger_types';
3838
],
3939
})
4040
export class DebuggerContainer implements OnInit, OnDestroy {
41-
readonly runs$ = this.store.pipe(select(getDebuggerRunListing));
41+
readonly runs$;
4242

43-
readonly runsIds$ = this.store.pipe(
44-
select(
45-
createSelector(getDebuggerRunListing, (runs): string[] =>
46-
Object.keys(runs)
47-
)
48-
)
49-
);
43+
readonly runsIds$;
5044

51-
readonly activeRunId$ = this.store.pipe(select(getActiveRunId));
45+
readonly activeRunId$;
5246

53-
constructor(private readonly store: Store<State>) {}
47+
constructor(private readonly store: Store<State>) {
48+
this.runs$ = this.store.pipe(select(getDebuggerRunListing));
49+
this.runsIds$ = this.store.pipe(
50+
select(
51+
createSelector(getDebuggerRunListing, (runs): string[] =>
52+
Object.keys(runs)
53+
)
54+
)
55+
);
56+
this.activeRunId$ = this.store.pipe(select(getActiveRunId));
57+
}
5458

5559
ngOnInit(): void {
5660
this.store.dispatch(debuggerLoaded());

tensorboard/plugins/debugger_v2/tf_debugger_v2_plugin/views/alerts/alerts_container.ts

+22-18
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,31 @@ const ALERT_TYPE_TO_DISPLAY_NAME_AND_SYMBOL: {
5959
changeDetection: ChangeDetectionStrategy.OnPush,
6060
})
6161
export class AlertsContainer {
62-
readonly numAlerts$ = this.store.pipe(select(getNumAlerts));
62+
readonly numAlerts$;
6363

64-
readonly alertsBreakdown$ = this.store.pipe(
65-
select(
66-
createSelector(getAlertsBreakdown, (alertsBreakdown) => {
67-
const alertTypes = Object.keys(alertsBreakdown);
68-
alertTypes.sort();
69-
return alertTypes.map((alertType): AlertTypeDisplay => {
70-
return {
71-
type: alertType as AlertType,
72-
...ALERT_TYPE_TO_DISPLAY_NAME_AND_SYMBOL[alertType],
73-
count: alertsBreakdown[alertType],
74-
};
75-
});
76-
})
77-
)
78-
);
64+
readonly alertsBreakdown$;
7965

80-
readonly focusType$ = this.store.pipe(select(getAlertsFocusType));
66+
readonly focusType$;
8167

82-
constructor(private readonly store: Store<State>) {}
68+
constructor(private readonly store: Store<State>) {
69+
this.numAlerts$ = this.store.pipe(select(getNumAlerts));
70+
this.alertsBreakdown$ = this.store.pipe(
71+
select(
72+
createSelector(getAlertsBreakdown, (alertsBreakdown) => {
73+
const alertTypes = Object.keys(alertsBreakdown);
74+
alertTypes.sort();
75+
return alertTypes.map((alertType): AlertTypeDisplay => {
76+
return {
77+
type: alertType as AlertType,
78+
...ALERT_TYPE_TO_DISPLAY_NAME_AND_SYMBOL[alertType],
79+
count: alertsBreakdown[alertType],
80+
};
81+
});
82+
})
83+
)
84+
);
85+
this.focusType$ = this.store.pipe(select(getAlertsFocusType));
86+
}
8387

8488
onToggleFocusType(alertType: AlertType) {
8589
this.store.dispatch(alertTypeFocusToggled({alertType}));

0 commit comments

Comments
 (0)