Skip to content

Commit 23b7921

Browse files
rileyajonesdna2github
authored andcommitted
Feature: Add route specific configuration for replaceState (tensorflow#5832)
add route specific configuration for replaceState
1 parent b20b70a commit 23b7921

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

tensorboard/webapp/app_routing/effects/app_routing_effects.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,11 @@ export class AppRoutingEffects {
308308
}),
309309
map((programmaticalNavigation) => {
310310
const nav = programmaticalNavigation!;
311-
const routeKind = nav.routeKind;
312-
const resetNamespacedState = nav.resetNamespacedState;
311+
const {replaceState = false, resetNamespacedState, routeKind} = nav;
313312

314-
// TODO(stephanwlee): currently, the RouteParams is ill-typed and you can
315-
// currently add any property without any type error. Better type it.
313+
// TODO(stephanwlee): currently, the RouteParams is ill-typed and you
314+
// can currently add any property without any type error. Better type
315+
// it.
316316
let routeParams: RouteParams;
317317
switch (nav.routeKind) {
318318
case RouteKind.COMPARE_EXPERIMENT:
@@ -325,16 +325,16 @@ export class AppRoutingEffects {
325325
default:
326326
routeParams = nav.routeParams;
327327
}
328-
return {routeKind, routeParams, resetNamespacedState};
328+
return {replaceState, routeKind, routeParams, resetNamespacedState};
329329
}),
330-
map(({routeKind, routeParams, resetNamespacedState}) => {
330+
map(({replaceState, routeKind, routeParams, resetNamespacedState}) => {
331331
const routeMatch = this.routeConfigs
332332
? this.routeConfigs.matchByRouteKind(routeKind, routeParams)
333333
: null;
334334
return {
335335
routeMatch,
336336
options: {
337-
replaceState: false,
337+
replaceState,
338338
browserInitiated: false,
339339
namespaceUpdate: {
340340
option: resetNamespacedState

tensorboard/webapp/app_routing/programmatical_navigation_types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ export interface NavigateToExperiment {
2424
routeKind: RouteKind.EXPERIMENT;
2525
routeParams: ExperimentRouteParams;
2626
resetNamespacedState?: boolean;
27+
replaceState?: boolean;
2728
}
2829

2930
export interface NavigateToCompare {
31+
replaceState?: boolean;
3032
routeKind: RouteKind.COMPARE_EXPERIMENT;
3133
routeParams: {
3234
aliasAndExperimentIds: Array<{alias: string; id: string}>;
@@ -35,6 +37,7 @@ export interface NavigateToCompare {
3537
}
3638

3739
export interface NavigateToExperiments {
40+
replaceState?: boolean;
3841
routeKind: RouteKind.EXPERIMENTS;
3942
routeParams: {};
4043
resetNamespacedState?: boolean;

0 commit comments

Comments
 (0)