Skip to content

Commit

Permalink
save some more bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Jun 28, 2023
1 parent 44cf765 commit abc3e98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ function renderComponent(component) {
refQueue
);

for (let i = 0; i < refQueue.length; i++) {
applyRef(refQueue[i], refQueue[++i], refQueue[++i]);
}
commitRoot(commitQueue, vnode);
commitRoot(commitQueue, vnode, refQueue);

if (vnode._dom != oldDom) {
updateParentDomPointers(vnode);
Expand Down
6 changes: 5 additions & 1 deletion src/diff/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ export function diff(
* which have callbacks to invoke in commitRoot
* @param {import('../internal').VNode} root
*/
export function commitRoot(commitQueue, root) {
export function commitRoot(commitQueue, root, refQueue) {
for (let i = 0; i < refQueue.length; i++) {
applyRef(refQueue[i], refQueue[++i], refQueue[++i]);
}

if (options._commit) options._commit(root, commitQueue);

commitQueue.some(c => {
Expand Down
5 changes: 1 addition & 4 deletions src/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ export function render(vnode, parentDom, replaceNode) {
refQueue
);

for (let i = 0; i < refQueue.length; i++) {
applyRef(refQueue[i], refQueue[++i], refQueue[++i]);
}
// Flush all queued effects
commitRoot(commitQueue, vnode);
commitRoot(commitQueue, vnode, refQueue);
}

/**
Expand Down

0 comments on commit abc3e98

Please sign in to comment.