angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.56k stars 3.01k forks source link

Transitions not working when toState was registered in runtime #3754

Closed fpoljak closed 4 years ago

fpoljak commented 5 years ago

This is a:

My version of UI-Router is: 1.0.15

Bug Report

Current Behavior:

When transitioning from any state to a state that was registered in runtime using $stateRegistry.register, no transition hooks are fired. The transition itself is successful.

EDIT:

Reopening the issue, I just reproduced it again. It seems to not work in two cases:

Not only the hooks are not fired, the transition doesn't happen at all.

I am using Google Chrome v.70.0.3538.110 on MacOS.

Expected Behavior:

Transition hooks always should be fired (unless {'notify': false} is specified in transition parameters perhaps). Transitions should always happen (unless cancelled) no matter if the state was registered in runtime, and is the transition initiated with a link, $state.go/transitionTo, entering url in browser, or using back/forward arrows in the browser.

I haven't included a plunker as it would be too complicated to reproduce, as I'm getting the menu items from the api, consisting of "standard" pages, that are defined in the config phase, and plugins, custom pages users can create and put in plugins folder and register through the api, which are then registered in the run time. This worked in old versions of ui-router.

I also haven't found any similar question on Stackoverflow, nor do I believe asking one would help me (at least not as quickly as I need).

fpoljak commented 5 years ago

Actually the transition hooks were firing, except for when the runtime state was an initial state, and there already is an issue for initial transition hooks not firing. My apologies.

fpoljak commented 5 years ago

Reopening the issue, I just reproduced it again. It seems to not work in two cases:

Not only the hooks are not fired, the transition doesn't happen at all.

I am using Google Chrome v.70.0.3538.110 on MacOS.

fpoljak commented 5 years ago

I also tried this with Firefox 63.0.3 for MacOS and it's the same.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.