ember-crumbly icon indicating copy to clipboard operation
ember-crumbly copied to clipboard

Is it possible to support routable engines?

Open Cryrivers opened this issue 8 years ago • 5 comments

Cryrivers avatar Nov 11 '16 12:11 Cryrivers

What are the issues you're seeing when trying to use it in combination with routable engines?

dguettler avatar Mar 19 '17 05:03 dguettler

What i am seeing is the following error

Assertion Failed: [ember-crumbly] Could not find a current route Error at assert (http://localhost:4200/assets/vendor.js:20974:13) at assert (http://localhost:4200/assets/vendor.js:32725:34) at Class.get (http://localhost:4200/engines-dist/authoring/assets/engine-vendor.js:5072:9) at ComputedPropertyPrototype.get (http://localhost:4200/assets/vendor.js:32381:28) at Object.get (http://localhost:4200/assets/vendor.js:37374:19) at RootPropertyReference.compute (http://localhost:4200/assets/vendor.js:30337:26) at RootPropertyReference.value (http://localhost:4200/assets/vendor.js:30204:45) at ArrayIterable.iterate (http://localhost:4200/assets/vendor.js:29960:26) at IterationArtifacts.isEmpty (http://localhost:4200/assets/vendor.js:59895:58) at IterablePresenceReference.value (http://localhost:4200/assets/vendor.js:64296:36)

Ill try to dig a bit more to get some more information.

mrkirchner avatar Apr 12 '17 22:04 mrkirchner

Looks like in bread-crumbs.js

currentRouteName: readOnly('applicationRoute.controller.currentRouteName'),

currentRouteName is undefined since controller is pretty much empty. This described case is where I have put crumbly inside a component within my Ember Engine.

If i try to move the breadcrumb to the parent applications i get:

[ember-crumbly] route:authoring was not found Error at assert (http://localhost:4200/assets/vendor.js:20974:13) at assert (http://localhost:4200/assets/vendor.js:32725:34) at http://localhost:4200/engines-dist/authoring/assets/engine-vendor.js:5134:9 at Array.map (native) at Class._lookupBreadCrumb (http://localhost:4200/engines-dist/authoring/assets/engine-vendor.js:5126:44) at Class.get (http://localhost:4200/engines-dist/authoring/assets/engine-vendor.js:5076:27) at ComputedPropertyPrototype.get (http://localhost:4200/assets/vendor.js:32381:28) at Object.get (http://localhost:4200/assets/vendor.js:37374:19) at RootPropertyReference.compute (http://localhost:4200/assets/vendor.js:30337:26) at RootPropertyReference.value (http://localhost:4200/assets/vendor.js:30204:45)

Hopefully that give you enough info to try to fix it. If you need me to do anything let me know. @dguettler

mrkirchner avatar Apr 12 '17 22:04 mrkirchner

I encountered this same problem with one of our projects, so think I found where this issue is coming from.

In the _lookupRoute function in the bread-crumbs component, the getOwner(this) function can only look up the routes that exist in the parent application. So, when it encounters a route that is inside of a routable engine, _lookupRoute returns undefined because it can't find the route because the route is owned by the engine, not the parent application that's hosting the engine.

After looking at how Ember Engines modified the internal router service for Ember, I believe that using the routing service and the getHandler(routeName) function will allow the route object to get looked up whether the route belongs to the parent app or an engine. I'm starting to work on a PR now that will hopefully help resolve this.

ascudder avatar Jun 23 '17 19:06 ascudder

@dguettler with #143 merged, what are the next steps to publishing a new version to NPM?

GCheung55 avatar Nov 06 '19 01:11 GCheung55