Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should event.navigationType for reloads be "reload" or "replace"? #117

Closed
domenic opened this issue May 20, 2021 · 1 comment · Fixed by #122
Closed

Should event.navigationType for reloads be "reload" or "replace"? #117

domenic opened this issue May 20, 2021 · 1 comment · Fixed by #122

Comments

@domenic
Copy link
Collaborator

domenic commented May 20, 2021

In working on #112 this came up. Currently it's specced as "replace", under the mental model that a reload is a same-URL replace.

Pros for treating reloads as "replace":

  • Simpler mental model: replace/push/traverse are all very distinct and carve up the universe of navigations nicely.
  • The distinction between appHistory.navigate(appHistory.current.url, { replace: true }) and appHistory.reload()/location.reload() is not very important and developers probably want to treat them similarly.

Potential reasons to separate reloads into a new "reload" type:

  • Maybe navigate handlers actually want to handle reloads specially, e.g. clearing UI state or something to give the user a "fresh" experience.
  • Browsers treat reloads somewhat distinct from same-URL replaces in a couple cases and surfacing this might be good:
    • APIs like service workers and navigation timing
    • Some of the details around scroll position restoration seem to differ, although not very interoperably.
domenic added a commit that referenced this issue May 20, 2021
Closes #112. Note that the behavior differs in that previously appHistory.navigate(options) would do a same-URL replace, which is subtly different from a reload in observable ways.

Some follow-up discussion in #117.
@Yay295
Copy link

Yay295 commented May 21, 2021

APIs like service workers and navigation timing

Since the PerformanceNavigation.type/PerformanceNavigationTiming.type property has a distinct value for reloads, I think it would also make sense to distinguish reloads in this API. Or maybe even use that API in this API. The Navigation Timing API is still in development though so I don't know what exactly that would look like.

domenic added a commit that referenced this issue May 25, 2021
Closes #112. Note that the behavior differs in that previously appHistory.navigate(options) would do a same-URL replace, which is subtly different from a reload in observable ways.

Some follow-up discussion in #117.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants