Skip to content

Conversation

@psybuzz
Copy link
Contributor

@psybuzz psybuzz commented Oct 6, 2020

Followup: #4220

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

[1] #4213

@psybuzz psybuzz marked this pull request as ready for review October 6, 2020 22:21
@psybuzz psybuzz requested a review from stephanwlee October 6, 2020 22:22
Comment on lines 234 to 236
// hash storage, set by tf-storage on the Polymer side. Due to async
// operators, we cannot guarantee that the initial 'navigated' action
// will be processed before any other URL-modifying logic.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it is purely about async operators.

For instance, if you are navigated to timeseries (#timeseries is written by HashStorage) and if you interact with the pinning, this effect will overwrite and remove #timeseries. In this case, HashStorage was not even attempt to write any hash so there is nothing timing related about this.

Could you more accurately depict the problem please?

Also I'd appreciate hash storage -> HashStorageComponent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the comment and dropped the part about async.

});

it('does not preserve hash upon replace for non-initial navigation', () => {
it('preserves hash upon navigations to the same route id', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

in this behavioral spec, maybe specify that this is a temporary behavior until all apps use the router?

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.

@psybuzz psybuzz requested a review from stephanwlee October 7, 2020 18:28
Copy link
Contributor

@stephanwlee stephanwlee left a comment

Choose a reason for hiding this comment

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

Thanks for updating the comments.

@psybuzz psybuzz merged commit 0dc528d into master Oct 12, 2020
@psybuzz psybuzz deleted the psybuzz-urlpins branch October 12, 2020 23:30
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