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

ui-sref needs two clicks after $state.go({notify false}) #2334

Closed
klmdb opened this issue Oct 26, 2015 · 18 comments
Closed

ui-sref needs two clicks after $state.go({notify false}) #2334

klmdb opened this issue Oct 26, 2015 · 18 comments
Labels

Comments

@klmdb
Copy link

klmdb commented Oct 26, 2015

Short:
ui-sref needs two clicks after $state.go({notify false}).

Long(er):
I use $state.go('stateName', stateparams, {notify:false}); in my controller to update the url without reloading the entire page and its controller/dependencies. This seems to work fine. A side effect is that after the url was updated this way, when the user clicks a link on the page, it doesn't work the first click. When clicking the link a second time it does.

I'm not getting any exceptions or errors.

@eddiemonge
Copy link
Contributor

please provide a plnkr example

@klmdb
Copy link
Author

klmdb commented Oct 28, 2015

Okay so I tried to create a plunker to show this behaviour:

http://plnkr.co/edit/eCpU0RGXDZ4O1kZmg63I

HOWEVER - I didn't fully succeed. That is to say: clicking ui-sref elements does immediatly change pages. Some odd things that might be related though:

  • when I am on state home.sub & I put a breakpoint in the beginning it's controller, it breaks when I click the link to go to home.sub2
  • when I change the url on home.sub by typing in the input field, the stateParameter 'name' is preserved when I go to home.sub2

Does that help? If more info is required please let me know and I'll try to answer asap. g2g now :p

@eddiemonge
Copy link
Contributor

There are a few bugs around notify. Your odd things 1 sounds like a known bug.

@mewert
Copy link

mewert commented Nov 10, 2015

I've also encountered this bug. With release 0.2.14 I can't reproduce it, so I will stick with that version until it is fixed.

Update: With 0.2.14 the nested routes seems to have problems, but with 0.2.13 everything seems to be fine...

@tchiloh
Copy link

tchiloh commented Nov 23, 2015

I have also this problem.

@tchiloh
Copy link

tchiloh commented Nov 23, 2015

Solution: #2003

@murli2308
Copy link

I am facing same issue ? any solution ?

@gattoo
Copy link

gattoo commented Jan 15, 2016

same for me

@ivan-zakharchuk
Copy link

same

As a simple workaround:

wrap your $state.go({notify false}) into $timeout(function() {});

and this should fix this call stack issue

@rivaros
Copy link

rivaros commented Jan 30, 2016

@ivanzvakoms that helped thanks. greetings to lviv.

@afgonzal
Copy link

Thanks Ivanzvakoms, that worked

@josholdham
Copy link

I have this issue, and the timeout fix didn't work for me. Upvote.

@aromanyukvakoms
Copy link

@josholdham ui-router contributors give all their effort to new version, so I think it would be better to find some workaround for this issue than waiting for fix.

@davidkaneda
Copy link

Just ran into this as well, and the timeout didn't work... For me this was happening with some links and not others and I realized the links/target states that were affected (requiring two clicks) all had resolves on them whereas the links that worked immediately did not.

Removing the resolves (and moving their logic into the controllers) fixed it for us.

@alvarodms
Copy link

Same issue here. Tested with both 0.2.13 and 0.2.15. $timeout workaround didn't work.

@saumyasuhagiya
Copy link

Same issue. any solution available?

@christopherthielen
Copy link
Contributor

FYI, we no longer support {notify: false} in ui-router 1.0+ because the state events have been removed

@stale
Copy link

stale bot commented Jan 24, 2020

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.

@stale stale bot added the stale label Jan 24, 2020
@stale stale bot closed this as completed Feb 7, 2020
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