Quantcast
Viewing all articles
Browse latest Browse all 4830

Idiomatic way of refreshing the route when deleting from a paged list

@gilles.g wrote:

Scenario is the following:

  1. We have a list of (Ember-Data) models displayed in a paged list. Paging is implemented using queryParams
  2. Each list row displays a “delete” button
  3. Clicking the “delete” button triggers an action in the controller that calls destroyRecord() on the model

At this point, we want to refresh() the route, since the model is outdated (a new item from the next page should pop up at the end of the list), but Ember cannot detect that on its own (or can it?).

We have identified two ways for doing that:

  • send() a “refresh” action from the controller to the route when the destroyRecord() promise is fulfilled
  • use the ember-route-action addon and implement the action directly in the route

Obviously the second one would not be idiomatic, since it requires the use of an addon.

Is there any other (better) way to do it?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles