Skip to content

Commit

Permalink
refactor(runtime-core): replace vnode.shapeFlag checks with existed f…
Browse files Browse the repository at this point in the history
…unctions
  • Loading branch information
noootwo committed Nov 15, 2024
1 parent a20a4cb commit a866b28
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/runtime-core/src/componentRenderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
type Data,
type FunctionalComponent,
getComponentName,
isStatefulComponent,
} from './component'
import {
Comment,
Expand Down Expand Up @@ -63,6 +64,7 @@ export function renderComponentRoot(
inheritAttrs,
} = instance
const prev = setCurrentRenderingInstance(instance)
const isStateful = isStatefulComponent(instance)

let result
let fallthroughAttrs
Expand All @@ -71,7 +73,7 @@ export function renderComponentRoot(
}

try {
if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
if (isStateful) {
// withProxy is a proxy with a different `has` trap only for
// runtime-compiled render functions using `with` block.
const proxyToUse = withProxy || proxy
Expand Down Expand Up @@ -154,9 +156,8 @@ export function renderComponentRoot(

if (fallthroughAttrs && inheritAttrs !== false) {
const keys = Object.keys(fallthroughAttrs)
const { shapeFlag } = root
if (keys.length) {
if (shapeFlag & (ShapeFlags.ELEMENT | ShapeFlags.COMPONENT)) {
if (isElementRoot(root)) {
if (propsOptions && keys.some(isModelListener)) {
// If a v-model listener (onUpdate:xxx) has a corresponding declared
// prop, it indicates this component expects to handle v-model and
Expand Down Expand Up @@ -210,8 +211,8 @@ export function renderComponentRoot(
if (
__COMPAT__ &&
isCompatEnabled(DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE, instance) &&
vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT &&
root.shapeFlag & (ShapeFlags.ELEMENT | ShapeFlags.COMPONENT)
isStateful &&
isElementRoot(root)
) {
const { class: cls, style } = vnode.props || {}
if (cls || style) {
Expand Down

0 comments on commit a866b28

Please sign in to comment.