Skip to content

Commit

Permalink
Merge pull request #1211 from lowaa/remove-mounts-unshift
Browse files Browse the repository at this point in the history
Chrome poor performance when calling array.unshift on a large array.
  • Loading branch information
marvinhagemeister committed Sep 24, 2018
2 parents b5c4a36 + 9b81167 commit 1369ab3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vdom/component.js
Expand Up @@ -189,7 +189,7 @@ export function renderComponent(component, renderMode, mountAll, isChild) {
}

if (!isUpdate || mountAll) {
mounts.unshift(component);
mounts.push(component);
}
else if (!skip) {
// Ensure that pending componentDidMount() hooks of child components
Expand Down
6 changes: 4 additions & 2 deletions src/vdom/diff.js
Expand Up @@ -24,11 +24,13 @@ let hydrating = false;

/** Invoke queued componentDidMount lifecycle methods */
export function flushMounts() {
let c;
while ((c=mounts.pop())) {
let c, i;
for (i=0; i<mounts.length; ++i) {
c = mounts[i];
if (options.afterMount) options.afterMount(c);
if (c.componentDidMount) c.componentDidMount();
}
mounts.length = 0;
}


Expand Down

0 comments on commit 1369ab3

Please sign in to comment.