-
Notifications
You must be signed in to change notification settings - Fork 3k
Notify:false fires the controller twice when changing state #2087
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
Comments
I feel this issue went unnoticed, as more recent ones are triaged as bug or design or similar, or get answers. |
A few comments: The docs for
Using We are deprecating state events ($stateChangeStart/Success/Error) in favor of a new architecture (which includes full Dynamic Params support). As such, |
Hello guys, I feel my need is related to this. I have 3 divs on which I want to activate a class if the state and params are as expected.
On the "details" page, I can also get from tab 0 to 1 or 2 manually, but then the class in the menu is not updating - it's exactly what dynamic params will be made for, no ? Is there a workaround for my production app until release is ready ? Thanks ! :) |
I bumped into this yesterday. While trying to write some tests to replicate, I found that the issue is no longer happening as of 997deb7 |
Fixed in f9b43d6 |
Hi guys, we bumped into this problem as well and the direct implementation of the fix in our app does not work. When trying the Plunker with the "supposed to be fixed" version also still shows the problem. Any hints? Here is the "fixed" Plunker: http://plnkr.co/edit/48UyEowm1zTeoZotlTu6?p=preview |
@shql +1. having exact same issue. |
@adamrabie See #1758 for a solution until 1.0 becomes stable. You need to use |
+1 this problem was NOT fixed. |
+1 |
Have found this thing to work for me, |
+1 |
The Bug
When a
$state.go
is called with{notify: false}
as follows, a bug occurred:On the next state change, the current controller will be initialised a second time.
Plunker Link
Follow the steps to reproduce on Plunker:
http://plnkr.co/edit/wMiVOb?p=preview
and
http://plnkr.co/edit/iqDuQrsjVWfySOrg1nv0?p=preview
Navigate to
foo
state, then click on Change URL button. The URL changes without reloading the controller, which is the wanted behavior.Click on the Change state 1 button.
The URL changes, I see a
$stateChangeStart
event with the current URL parameters, the controller is called.Then I see a
$stateChangeSuccess
event with the new URL parameters and the controller is called again.If you click now on the Change state 2 button, both events have the same URL parameters, so there is no double controller call.
It looks like the
notify: false
parameter don't do a "real" URL parameters update, so UI-router has to do a double state change to reconcile the parameters it knows with the ones it discovers, then with the ones requested...I saw a number of issues more or less related, like #1758, but I am not sure if they are entirely the same. So I went ahead and made my own issue with a demonstration to illustrate it. 😄
The text was updated successfully, but these errors were encountered: