Skip to content

Conversation

askvortsov1
Copy link
Member

In this PR:

  • We move calls to create/modify app.previous and app.current from oninit to onNewRoute (inspired by Abort requests on route change #2319 (comment))
  • We call onNewRoute in onbeforeupdate for DiscussionPage and UserPage as well as in IndexPage (so that several visits to DiscussionPage in a row don't count as one "PageState".

This also sets us up for possible changes like #2275 (comment)

Call onNewRoute when page changed with same component in DiscussionPage and UserPage
Make app.previous and app.current changed in onNewRoute, not in oninit. This way, when the route is changed, but still handled by the same component, a new PageState object will still be created.
@clarkwinkelmann
Copy link
Member

On its own, does this diff introduce any change of behavior?

Does it change anything in regard to the navigation history?

Does it make sense to call app.current.set('routeName', this.attrs.routeName); if it's called everytime a new PageState is created? Shouldn't this be passed as a constructor argument then?

@askvortsov1
Copy link
Member Author

Not to navigation history, but if you go from one discussions page to another discussions page, app.current and app.previous will more accurately reflect that, instead of acting like we never left the page.

And yeah, those can be condensed into one argument. Will do.

@askvortsov1 askvortsov1 merged commit 44a96a8 into master Oct 2, 2020
@askvortsov1 askvortsov1 deleted the as/onNewRoute_improvements branch October 2, 2020 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants