Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

perf(select): Execute render after $digest cycle#8825

Closed
wesleycho wants to merge 2 commits into
angular:masterfrom
wesleycho:select_optimization
Closed

perf(select): Execute render after $digest cycle#8825
wesleycho wants to merge 2 commits into
angular:masterfrom
wesleycho:select_optimization

Conversation

@wesleycho

Copy link
Copy Markdown
Contributor

This is an optimization to defer execution of the render function in the
select directive after the $digest cycle completes inside the
$watchCollection expressions. This does a check to see if the render
function is already registered in the $$postDigestQueue before it passes
it into $$postDigest, guaranteeing that the DOM manipulation happens
only in one execution after the model settles.

This is an optimization to defer execution of the render function in the
select directive after the $digest cycle completes inside the
$watchCollection expressions.  This does a check to see if the render
function is already registered in the $$postDigestQueue before it passes
it into $$postDigest, guaranteeing that the DOM manipulation happens
only in one execution after the model settles.
Comment thread src/ng/directive/select.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing indexOf you could just have a internal boolean flag renderScheduled and set it to true when you schedule via postDigest and in postDigest reset it to false.

Add reset of toggle
@wesleycho wesleycho force-pushed the select_optimization branch from c687b77 to 4c3d9bf Compare August 29, 2014 04:36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be the first thing in the render method in case an exception is thrown in the body

@IgorMinar IgorMinar closed this in 6f7018d Aug 29, 2014
@IgorMinar

Copy link
Copy Markdown
Contributor

thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants