Skip to content

Calling ".refresh()" from the router service #592

@NullVoxPopuli

Description

@NullVoxPopuli

Right now, refresh only exists on the route.
It'd be fantastic if we had a central place to call refresh.

Update 1

@service router;
// ...
// refreshes current route
this.router.refresh() 
// refreshes the application and all child routes
this.router.refresh('application') 

// maybe typed this way
refresh(routeName?: string): Promise<void>;

Original Text

Maybe this is something that exists on each RouteInfo that makes of the list of route infos representing the current route?

Given:

this.route('posts', function() {
  this.route('show', { path: ':id' });
})

And I want to refresh just the show route, maybe I'd do:

@service router;

// ...
this.router.currentRoute.refresh();

And give that the route tree is represented as a linked list:

<RouteInfo#application>
   ⇩
<RouteInfo#posts>
   ⇩
<RouteInfo#show>  <- currentRoute

maybe I want to refresh just the posts route?

this.router.currentRoute.parent.refresh();

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions