poteto / ember-crumbly

Declarative breadcrumb navigation for Ember apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ember CLI ^2.10.x fails to set route breadCrumb value to a Model

charneykaye opened this issue · comments

Previously, in a route I would simply use this line to set the breadCrumb to a model after the model for that route is loaded. It was a nice one-step way to get ember-crumbly to create a named link directly to that record's URL. Like this:

afterModel(model) {
  Ember.set(this, 'breadCrumb', model);
}

However, as of Ember ^2.10.x this throws Assertion Failed: Cannot clone an Ember.Object that does not implement Ember.Copyable

Thoughts? I've implemented a workaround:

afterModel(model) {
  Ember.set(this, 'breadCrumb', {
    title: model.get("name")
  });
}

But.... whain.

Thanks!

This might actually be related to a recent change in ember-crumbly.
We are now copying the breadCrumb before modifying it so the original value stays around unchanged. I can't think of a better solution right now.
Above seems like a reasonable workaround.
Sorry for the inconvenience this is causing for you.

It has turned out, the new implementation is better. It is a better representation of the relationship between my business rules and ember-crumbly, e.g. having a model (nested in the middle of a the route) wherein the breadCrumb is computed via some custom anomaly.

My recommendation is simply (if possible, easily) to improve the error message thrown in this case. Something like Invalid breadCrumb for route: Please construct a POJO for use as a breadCrumb