Skip to content

Commit 9c9d1e1

Browse files
authored
Embedded Single Card: don't fetch runs on card route (#6522)
Don't fetch runs for the internal card component.
1 parent 6227be9 commit 9c9d1e1

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

tensorboard/webapp/runs/effects/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ tf_ng_module(
1414
"//tensorboard/webapp:app_state",
1515
"//tensorboard/webapp:selectors",
1616
"//tensorboard/webapp/app_routing",
17+
"//tensorboard/webapp/app_routing:types",
1718
"//tensorboard/webapp/app_routing/actions",
1819
"//tensorboard/webapp/core/actions",
1920
"//tensorboard/webapp/runs:types",
@@ -40,6 +41,7 @@ tf_ts_library(
4041
"//tensorboard/webapp/angular:expect_angular_core_testing",
4142
"//tensorboard/webapp/angular:expect_ngrx_store_testing",
4243
"//tensorboard/webapp/app_routing:testing",
44+
"//tensorboard/webapp/app_routing:types",
4345
"//tensorboard/webapp/core/actions",
4446
"//tensorboard/webapp/runs/actions",
4547
"//tensorboard/webapp/runs/data_source",

tensorboard/webapp/runs/effects/runs_effects.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from 'rxjs/operators';
2929
import {areSameRouteKindAndExperiments} from '../../app_routing';
3030
import {navigated} from '../../app_routing/actions';
31+
import {RouteKind} from '../../app_routing/types';
3132
import {State} from '../../app_state';
3233
import * as coreActions from '../../core/actions';
3334
import {
@@ -159,7 +160,11 @@ export class RunsEffects {
159160
this.experimentsWithStaleRunsOnRouteChange$,
160161
this.experimentsWithStaleRunsOnReload$
161162
).pipe(
162-
mergeMap(({experimentIds, experimentIdsToBeFetched}) => {
163+
withLatestFrom(this.store.select(getActiveRoute)),
164+
filter(
165+
([, route]) => route !== null && route.routeKind !== RouteKind.CARD
166+
),
167+
mergeMap(([{experimentIds, experimentIdsToBeFetched}]) => {
163168
return this.fetchAllRunsList(experimentIds, experimentIdsToBeFetched);
164169
})
165170
);

tensorboard/webapp/runs/effects/runs_effects_test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
buildNavigatedAction,
2424
buildRoute,
2525
} from '../../app_routing/testing';
26+
import {RouteKind} from '../../app_routing/types';
2627
import {State} from '../../app_state';
2728
import * as coreActions from '../../core/actions';
2829
import {
@@ -472,6 +473,24 @@ describe('runs_effects', () => {
472473
});
473474
});
474475

476+
[
477+
{specAction: buildNavigatedAction, specName: 'navigation'},
478+
{specAction: coreActions.manualReload, specName: 'manual reload'},
479+
{specAction: coreActions.reload, specName: 'auto reload'},
480+
].forEach(({specAction, specName}) => {
481+
it(`does not fetch runs on card route when action is ${specName}`, () => {
482+
store.overrideSelector(getActiveRoute, {
483+
routeKind: RouteKind.CARD,
484+
params: {},
485+
});
486+
store.refreshState();
487+
488+
action.next(specAction());
489+
490+
expect(actualActions).toEqual([]);
491+
});
492+
});
493+
475494
describe('on navigation', () => {
476495
it('fetches for runs if not loaded before', () => {
477496
const createFooRuns = () => [

0 commit comments

Comments
 (0)