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
Resolves not working when enabling the sticky states plugin #3
Comments
@cloudmark thanks for the very detailed bug and instructions. It really helped me track this one down. I switched the sticky states I'd also like to clear up some confusion, for posterity:
This was actually due to a problem with the published UMD bundles of ui-router-ng2. We were including all the code from Unfortunately, the fix involves releasing a new ui-router-ng2 which does not bundle the ui-router-core code in its UMD bundle. This also means you have to add an entry in your systemjs config file for the
In ui-router-core 3.0.0, the I've released sticky-states 1.2.0 which depends on ui-router-core 3.x-4.x. I'll be releasing 1.3.0 soon which depends on ui-router-core ^5.0.0 and updates to the new apis |
I am seeing same issue with angular-ui-router 1.0.4 , @uirouter/sticky-states v1.4.1 and @uirouter/core v5.0.4 I am using loading the js in the order of angular-ui-router , uirouter core and sticky-state. |
@mohanrao I ran into this problem as well. As @christopherthielen mentioned it's because of ui-router-core is loaded twice. See this notice in angular-ui-router.js.
I know you released bower components for ui-router-core and ui-router-sticky states in this other issue. If you look closely at the files in bower_components/angular-ui-router/release, you'll notice ui-router-angular.js is included. So the last thing you need to do is add to bower.json's overrides section to change the main file loaded by angular-ui-router. This is where you would define the dependencies as well. For my purposes, I made it require both core and sticky-states.
|
Thanks @mevludin90 . I forgot put the notes on this issue. I figured out the same. And did the same in my bower.json |
My project ran into the same issue after I installed But everything works ok on release $ npm ls | grep router
├── @uirouter/dsr@1.0.2
├─┬ @uirouter/sticky-states@1.4.1
├─┬ angular-ui-router@1.0.3
│ └── @uirouter/core@5.0.3 |
Description
Resolves throw a DI error when enabling the sticky states plugin. This happens due to the fact that the original
PathNode
references are being change.Reproduce
The repository https://github.com/cloudmark/ui-router-stickstates-bug outlines the problem with ui-router-sticky-states transitions. In order to run this demo first install the dependencies using
and run the code using:
As soon as you run the code the first error shows up, this is due to a refactor in
ui-router-core
:In order to fix this error update the code in
/node_modules/ui-router-core/lib/path/node.js
from:to
Note: Don't know if you would prefer if I report this as a separate bug in the ui-router-core project.
Refreshing the console again should now give the DI Error for Transition (what we are after!):
Debugging
Debugging within the stack trace we can see
No provider for Transition!
.Stepping through the resolution code one can observe that the
subPath
inResolveContext
includes a node with name:app.home
even though the current node also has state name
app.home
(subPath
should not include the current node). ThesubNode
is included since the original reference is not the same (even though the properties of the path nodes are the same) and hencereturn r.token === token
returns false.Since the
subPath
includes also theapp.home
node which has a resolvable requiring the Transition dependency, this resolvable is not included in the list ofavailableResolvables
and hence is not resolved.So where is the reference being changed? References are changes when trying to compute the active and inactive states in the sticky states code whilst running the simulate transition.
Specifically the line:
creates shallow clones of the original PathNodes.
The references are swapped in the lines that follow:
The text was updated successfully, but these errors were encountered: