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

add refresh method to router service #631

Merged
merged 8 commits into from
Oct 9, 2020

Conversation

Gaurav0
Copy link
Contributor

@Gaurav0 Gaurav0 commented May 23, 2020

Part of issue #629

Rendered

text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

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

Should this also deprecate Route#refresh()? And/Or change its implementation to delegate to RouterService?

@rwjblue
Copy link
Member

rwjblue commented May 25, 2020

@mehulkar Route.prototype.refresh is a tad different than this new method being proposed. It refreshes whatever route you call it on and all routes “below” it in the route hierarchy. The method proposed here always refreshes all routes.

That being said, I think it would be good to mention the service method from the route documentation, to make it super easy for folks to see there is a service mechanism to do this also.

@acorncom
Copy link
Contributor

It refreshes whatever route you call it on and all routes “below” it in the route hierarchy. The method proposed here always refreshes all routes.

Would we want to be opting for different behavior and refreshing all routes or is the implicit goal here to refresh only the current route (as defined from the perspective of the caller)? The “defined from the perspective of the caller” part seems quite tricky to implement well (and consistently) ...

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented May 25, 2020

Should this also deprecate Route#refresh()? And/Or change its implementation to delegate to RouterService?

In my opinion, no. We should keep it around until we are sure we have filled in all the gaps. There may be a use case for refreshing an only some of the active routes, possibly.

text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0000-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
@Gaurav0
Copy link
Contributor Author

Gaurav0 commented May 27, 2020

@rwjblue revised.

@mike183
Copy link
Contributor

mike183 commented May 30, 2020

@rwjblue @acorncom I think it would be useful to have a method on the router service for refreshing the current route (including child routes).

I had a recent use case for providing a “Try Again” button when a route failed to load due to a timeout.

I did look for some method of refreshing the route but ended up resorting to just redirecting to a parent route which so happened to redirect back to the route that I wanted to refresh.

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Jul 23, 2020

@mike183 How about adding an optional routeName argument as proposed in #592 ?

@mike183
Copy link
Contributor

mike183 commented Jul 23, 2020

@mike183 How about adding an optional routeName argument as proposed in #592 ?

That seems like it would work 👍

@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Jul 30, 2020

@mike183 @rwjblue Updated. Please rereview.

text/0631-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0631-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
text/0631-refresh-method-for-router-service.md Outdated Show resolved Hide resolved
@Gaurav0
Copy link
Contributor Author

Gaurav0 commented Jul 30, 2020

@rwjblue Thanks again for the fast review.

@Gaurav0 Gaurav0 requested a review from rwjblue July 30, 2020 19:09
@rwjblue rwjblue self-assigned this Jul 30, 2020
@mike183
Copy link
Contributor

mike183 commented Aug 3, 2020

Apologies for the delayed response.

The updates all look good to me, nice work 👍

@mehulkar
Copy link
Contributor

mehulkar commented Aug 3, 2020

Re-reading this after a while, does my previous question/suggestion apply more, now that pivotRouteName is introduced? In other words, could Route.prototype.refresh be implemented as:

{
  refresh() {
    routerService.refresh(this.fullName)
  }
}

@rwjblue
Copy link
Member

rwjblue commented Aug 4, 2020

Re-reading this after a while, does my previous question/suggestion apply more, now that pivotRouteName is introduced? In other words, could Route.prototype.refresh be implemented as:

{

  refresh() {

    routerService.refresh(this.fullName)

  }

}

Ya, I think that makes sense, though I'm not sure it really matters from an RFC perspective (since it doesn't really change any existing API surface, it just makes the implementation make more sense).

Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 19, 2021
This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 19, 2021
This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 19, 2021
This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 19, 2021
This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
Windvis added a commit to ember-polyfills/ember-router-service-refresh-polyfill that referenced this pull request Mar 20, 2021
This adds a `refresh` method to the RouterService as described in RFC
631

RFC PR: emberjs/rfcs#631
Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 23, 2021
…router service

This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 24, 2021
…router service

This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
Windvis added a commit to Windvis/ember.js that referenced this pull request Mar 25, 2021
…router service

This adds the refresh method to the RouterService as described in RFC 631.

RFC PR: emberjs/rfcs#631
@MariannaAtPlay
Copy link

This is a great idea! Wondering what's the timeline for implementing this in Ember core?

jgwhite added a commit to hashicorp/waypoint that referenced this pull request Aug 27, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Aug 30, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Aug 30, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Aug 30, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Aug 31, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Aug 31, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 1, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 1, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 1, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 1, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 2, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 2, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 2, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 6, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 6, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
jgwhite added a commit to hashicorp/waypoint that referenced this pull request Sep 7, 2021
This is rather inelegant but the [RouterService.refresh] method is
not yet available to us.

[RouterService.refresh]: emberjs/rfcs#631
@snewcomer
Copy link
Contributor

@MariannaAtPlay This was implemented in 4.1.0-beta.1.!

https://github.com/emberjs/ember.js/blob/master/CHANGELOG.md#v410-beta1-november-19-2021

ef4 added a commit that referenced this pull request Aug 4, 2023
Advance RFC #631 `"RouterService#refresh"` to Stage Recommended
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants