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

$state.go to current state reloads controller with notify set to false (broken by 0.2.11) #1387

Closed
mafredri opened this issue Sep 22, 2014 · 18 comments
Assignees
Labels
Milestone

Comments

@mafredri
Copy link

I'm unsure if this is the intended functionality, but commit 7b78ede breaks $state.go($state.current.name, params, {notify: false});

$state.go can be called one time without reloading the controller, but the second time it is called the controller also gets reloaded, reverting the commit fixes the issue.

I created a plunkr for good measure to demonstrate the issue. http://plnkr.co/edit/jvuPlkcGmYNwhptUvcHY?p=preview

@mafredri
Copy link
Author

mafredri commented Oct 9, 2014

Any update on this? How should I reload a state with new parameters without reloading the controller?

@nateabele
Copy link
Contributor

Okay, seems like that should be based on the notify value passed to go().

@christopherthielen
Copy link
Contributor

@hyzhak
Copy link

hyzhak commented Feb 15, 2015

@christopherthielen @mafredri @nateabele
here is another case which break ui-router:
http://plnkr.co/edit/i32gBWblr3JaG2aNcnzg?p=preview
after you have something like:

$state.go('stateA', {param: newvalue}, notify: false);

any other command like:

$state.go('stateB');

or

$state.go('stateA.substate');

reload controller.
Steps to reproduce:

  1. push 'Reload state';
  2. push 'go to state.index1';
  3. Controller reloads will update to 1;
  4. push 'Realod state'; 5) and so on...

@ChenMorSays
Copy link

Not working for me as well.
I have tried every idea I could find on the internet but the issue still persists.
When I try to update the current state parameters with notify set to false, it works fine, but when I try to switch to a different state, the previous state just seem to reload.
Any new ideas please?

@christopherthielen
Copy link
Contributor

What are you trying to accomplish by setting notify to false?

@ChenMorSays
Copy link

I'm trying to update the parameters of the current state, in order to update the url

@hyzhak
Copy link

hyzhak commented Jun 9, 2015

I have same use case - I need to reflect state of app to url (in my case they are current page of pagination and search query string). But this bugs prevent update without page reloading.

@mafredri
Copy link
Author

mafredri commented Jun 9, 2015

What version are you using? This is still working for us in 0.2.13. Maybe you should open a new issue?

@hyzhak
Copy link

hyzhak commented Jun 9, 2015

@mafredri if you ask me - I'm using the last one 0.2.15 and nothing was changed till there here is my deeply explanation #1758

@hyzhak
Copy link

hyzhak commented Jun 9, 2015

@mafredri btw you have Perast and island Gospa, Montenegro at your avatar - I'm living near there :). Sorry about offtopic

@mafredri
Copy link
Author

mafredri commented Jun 9, 2015

@hyzhak yea looks like you have a valid bug in your issue, but it looks unrelated to this one.

Also, cool, I was just touristing there, but nice spot! :)

@not-only-code
Copy link

It happens to me exactly as @mafredri and @hyzhak explained. After changing the same state with different parameters and notify: false in order to don't reload the controller, if you want to go to another state it reloads the same state before to change to the next one.

@jabyrd3
Copy link

jabyrd3 commented Aug 10, 2015

Any workaround for this? It's holding me up as well.

@jabyrd3
Copy link

jabyrd3 commented Aug 10, 2015

Also, for the record, I'm seeing this issue (reload original state on state change event after path has been updated via notify: false) on both 2.13 and 2.15.

@natwallbank
Copy link

I just encountered this issue too (0.2.14). Had to settle on a combination of $location.search and reloadOnSearch: false to achieve what I needed to.

@dhavyd
Copy link

dhavyd commented Nov 23, 2015

I have the habe problem here, using v0.2.15.

I have this

$state.go('myState', $stateParams, {notify: false});

When I run $state.go() in a later context, then the entire "state tree", including the parents, are reloaded (view, controller, etc). The only way to work around that is using "reloadOnSearch: false" on the parent state. The problem is that I need to reload the parent state, in other contexts, so I can't set that for the entire state, but need to decide when not to reload the parent state, for ex using "notify: false".

@DannyRubenMA
Copy link

Test with $location.path(state); and $location.path().replace(); obviously using ui-router

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

No branches or pull requests

10 participants