Skip to content

Conversation

@psybuzz
Copy link
Contributor

@psybuzz psybuzz commented Oct 1, 2020

See #4207 for details.

Several callsites in TB's Angular and Polymer codebases read
directly from window.location.search. For example, scalar cards
read the ?tensorboardColab=true param at arbitrary times in
the TB session, to know whether TB is running inside Colab.

AppRoutingEffects has an initialization step that clears/discards
all existing URL queryParams, causing breaking behavior.

Since AppRouting is not yet a complete source of truth for URL
query params, this change makes all callsites that read from
window.location.search do so on the initial app load, before
AppRouting can interfere.

An alternative considered was making AppRoutingEffects aware
of a hardcoded list of reserved queryParam keys, and preserving
them whenever updating the URL. In that approach, there are
some unknown questions, e.g. if a user navigates to a different
route and returns to the original route, do we still need to preserve
queryParams?

Manually tested that running TB with ?tensorboardColab=true
and opening scalar cards results in network requests to
the /scalars endpoint, not /scalars_multirun.

@psybuzz psybuzz requested review from stephanwlee and wchargin and removed request for stephanwlee and wchargin October 1, 2020 20:54
Comment on lines 21 to 22
* Ideally, AppRouting would manage all URL params.
* https://github.com/tensorflow/tensorboard/issues/4207
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop this line. Even if router gains the capability, we want this component to read from the URL to bootstrap certain feature flags states.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

@psybuzz
Copy link
Contributor Author

psybuzz commented Oct 2, 2020

As per offline discussion, in a followup CL, I will write a regression test that checks that our app doesn't emit POST requests under ?tensorboardColab=true.

@psybuzz psybuzz merged commit e5be849 into tensorflow:master Oct 2, 2020
@psybuzz psybuzz deleted the paramint branch October 7, 2020 17:26
psybuzz added a commit that referenced this pull request Oct 12, 2020
AppRoutingEffects recently added logic to preserve URL hash
upon the initial 'navigated' action (see [1]). While this fixed cases
where the URL needs to be read upon initial page load, it does
not address an upcoming case needed for deeplinking pins in
Time Series.

Flow: pin a card, DeepLinkProvider serializes `?pinnedCards=`
in the URL which drops `#timeseries`, reload the tab, the
selected dashboard is no longer Time Series.
Expected: Time Series remains selected upon tab reload.

This change overcomes this issue the DeepLinkProvider by
preserving the hash upon same-RouteId navigations.

Manually checked internal TB embedders that navigating to
a different route id still clears the hash.

Googlers, see sync cl/335688801
Followup: #4220

[1] #4213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants