0.2.16 and 1.0.0alpha0: ui-sref-active has slight delay #2503

Closed
pavel-blagodov opened this Issue Jan 30, 2016 · 8 comments

Projects

None yet

4 participants

@pavel-blagodov

I noticed that ui-sref-active has slight delay that leads to flickering of elements with that directive. This is especially noticeable in case of reload: true, but that's not the issue if we are using ng-class="{selected: ('app.state' | includedByState)}

@pavel-blagodov pavel-blagodov changed the title from ui-sref-active has slight delay to 1.0.0alpha0: ui-sref-active has slight delay Jan 30, 2016
@nateabele
Member

Weird. Can you post a plunkr that demonstrates the issue?

@christopherthielen christopherthielen self-assigned this Jan 31, 2016
@christopherthielen christopherthielen added this to the 1.0.0-alpha.1 milestone Jan 31, 2016
@christopherthielen
Contributor

I'll take a look at this before alpha.1

@christopherthielen
Contributor

This was introduced in 0.2.16 https://plnkr.co/edit/4gfShkbPt7tDHp4jBBNM?p=preview

Related: #1997 #2012

@christopherthielen christopherthielen changed the title from 1.0.0alpha0: ui-sref-active has slight delay to 0.2.16 and 1.0.0alpha0: ui-sref-active has slight delay Feb 14, 2016
@christopherthielen christopherthielen removed the 1.0 label Feb 14, 2016
@joshuahiggins
Contributor

This is related to the application of the class being pushed into the next cycle to prevent the race condition found in #1997. Should be a pretty low hanging fix. Want a PR against 0.2 or 1.0.0?

@christopherthielen
Contributor

Would prefer against 1.0. It should cherry pick pretty smoothly to legacy.

I'd love a test too.

@ns-codereview ns-codereview pushed a commit to couchbase/ns_server that referenced this issue Feb 17, 2016
@pavel-blagodov @dave-finlay pavel-blagodov + dave-finlay MB-12222: update ui-router to version 1.0.0 alpha0
We have to use latest ui router because it has transitionsProvider,
we need transitionsProvider in order to properly handle transition
to the state with rbac permissions
https://github.com/angular-ui/ui-router/releases/tag/1.0.0alpha0

Old ui-router is deprecated
https://github.com/angular-ui/ui-router/releases/tag/0.2.17

Process of migrating is pretty smooth, although there are couple bugs
angular-ui/ui-router#2504
angular-ui/ui-router#2503

Change-Id: I67fc81adecf5ebf9cf294171d5583f8555696cee
Reviewed-on: http://review.couchbase.org/59318
Reviewed-by: Dave Finlay <dave.finlay@couchbase.com>
Tested-by: Dave Finlay <dave.finlay@couchbase.com>
cc7ef04
@christopherthielen christopherthielen added a commit that closed this issue Nov 5, 2016
@christopherthielen christopherthielen fix(ui-sref-active): Add CSS class immediately (avoid delay)
- a timeout is used to allow the CSS class to be added in an ng-repeat, where angular resets the class="" attr from the expression
- also add the class without a timeout, to avoid flicker

Closes #2503
27eb5e9
@christopherthielen christopherthielen added a commit that referenced this issue Nov 5, 2016
@christopherthielen christopherthielen fix(ui-sref-active): Use `$scope.$evalAsync` to apply css class
- Reduce digests caused by removing `$timeout` calls
- This seems to fix the broken behavior reported in both #2503 and #1997

Closes #2503
Closes #1997
Supercedes #2012
6a9d9ae
@christopherthielen christopherthielen added a commit that referenced this issue Nov 5, 2016
@christopherthielen christopherthielen feat(ui-sref-active): improve performance by reducing $watches
fix(ui-sref-active): Avoid add/remove class race condition
refactor(ui-sref-active): Apply all CSS changes in a single `$evalAsync`

See also: 6a9d9ae #1997 #2503 #1997 #2012

Closes #2777
126a4ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment