Skip to content

Commit

Permalink
perf(runtime): refactor delay initializing prop
Browse files Browse the repository at this point in the history
  • Loading branch information
unbyte committed May 13, 2021
1 parent c546ae5 commit e732188
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,14 @@ function baseCreateRenderer(
let priority
for (const key in props) {
if (!isReservedProp(key)) {
if (!(priority = hostDelayInitProp(el, key))) {
if ((priority = hostDelayInitProp(el, key))) {
!delayed && (delayed = [])
if (priority > 0 || priority === true) {
delayed.push(key)
} else {
delayed.unshift(key)
}
} else {
hostPatchProp(
el,
key,
Expand All @@ -830,17 +837,11 @@ function baseCreateRenderer(
parentSuspense,
unmountChildren
)
} else {
!delayed && (delayed = [])
;(priority > 0 || priority === true
? Array.prototype.push
: Array.prototype.unshift
).call(delayed, key)
}
}
}
delayed &&
delayed.forEach(key =>
if (delayed) {
for (const key of delayed) {
hostPatchProp(
el,
key,
Expand All @@ -852,7 +853,8 @@ function baseCreateRenderer(
parentSuspense,
unmountChildren
)
)
}
}
}

if ((vnodeHook = props.onVnodeBeforeMount)) {
Expand Down

0 comments on commit e732188

Please sign in to comment.