Skip to content
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

Error: Could not resolve '[object Object]' from state X #374

Open
anastasiagryshchenko opened this issue Jan 17, 2020 · 3 comments
Open

Comments

@anastasiagryshchenko
Copy link

While working with future states we are consistently seeing an issue when first try to redirect to the view in a future state (e.g. with a $state.go) results in no redirect and an error stack trace provided bellow. However, the second try always results in successful redirect. Network tab also shows that the module is being successfully loaded on the first try.

Using a direct url of the state in an anchor's tag href seems to be the workaround, but I was wondering if this was something that could be fixed by either changing the way we work with the react-hybrid or by changing library code.

I was going through the logic and got to this point
Screenshot 2020-01-18 at 01 05 24

on the second try definition is present

I would really appreciate help with this and let me know if there is anything I could do to help investigate this better. Thanks!

angular.js:13424 Error: Could not resolve '[object Object]' from state 'app.project'
at new Transition (webpack:///./node_modules/@uirouter/core/lib-esm/transition/transition.js?:79:19)
at TransitionService.create (webpack:///./node_modules/@uirouter/core/lib-esm/transition/transitionService.js?:174:16)
at Transition.redirect (webpack:///./node_modules/@uirouter/core/lib-esm/transition/transition.js?:492:59)
at eval (webpack:///./node_modules/@uirouter/core/lib-esm/state/stateService.js?:370:42)
at processQueue (webpack:///./node_modules/angular/angular.js?:15757:28)
at eval (webpack:///./node_modules/angular/angular.js?:15773:27)
at Scope.$eval (webpack:///./node_modules/angular/angular.js?:17025:28)
at Scope.$digest (webpack:///./node_modules/angular/angular.js?:16841:31)
at eval (webpack:///./node_modules/angular/angular.js?:17064:26)
at completeOutstandingRequest (webpack:///./node_modules/angular/angular.js?:5824:10

@christopherthielen
Copy link
Member

@anastasiagryshchenko
in the screenshot, it looks like the transition has a "relative" value of app.foo but is trying to transition to app.foo.**, is this correct?

What other details can you provide? Is this a pure $state.go() call you're making imperatively? Or from a UISref?

@anastasiagryshchenko
Copy link
Author

behavior is the same for both $state.go and UISref navigation.

the first transition is trying to resolve future state instead of the specific one and fails, we can observe the module load, and then the next time user tries to navigate to smth (e.g.click on the link with ui-sref) everything works correctly.

@christopherthielen
Copy link
Member

This is surprising. Especially the result of targetState.name() being { url: "/deployments", name: "app.deployments.**", $$state: f }.
The logic found in name() should have returned app.deployments.**:

  /** The name of the state this object targets */
  name(): string {
    return (this._definition && this._definition.name) || <string>this._identifier;
  }

Can you provide the following additional info:

Output of:

  • npm ls @uirouter/angular-hybrid
  • npm ls @uirouter/core
  • npm ls @uirouter/angular
  • npm ls @uirouter/angularjs

What is in targetState._identifier?

As long as you're stepping through ui-router code, can you step through TargetState constructor, specifically this line
https://github.com/ui-router/core/blob/e657cfef2a36be136456710974f8b3078d57e697/src/state/targetState.ts#L74

This should be finding the futurestate StateObject from the StateRegistry that matches the glob app.deployments.**. However, since _definition is empty, it must not have been found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants