chore(runtime-core): simplify block-tracking disabling in h function#13841
chore(runtime-core): simplify block-tracking disabling in h function#13841edison1105 merged 1 commit intomainfrom
Conversation
WalkthroughRefactors h() to use a top-level try/finally that disables and re-enables block tracking around all logic. Removes the internal doCreateVNode helper and routes all branches to direct createVNode calls. Adjusts argument handling for 2+ arguments to consistently derive props and children without altering the public API. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Caller
participant H as h()
participant BT as BlockTracking
participant V as createVNode
C->>H: h(type, propsOrChildren?, ...children)
Note over H: Enter try/finally scope
H->>BT: setBlockTracking(-1) (disable)
alt l === 2
alt propsOrChildren is array
H->>V: createVNode(type, null, propsOrChildren)
else propsOrChildren is object (not array)
alt single vnode child (no props)
H->>V: createVNode(type, null, [propsOrChildren])
else props-only
H->>V: createVNode(type, propsOrChildren)
end
else primitive/text child
H->>V: createVNode(type, null, propsOrChildren)
end
else l > 2
Note over H: Derive children from extra args\n- 3 args: wrap single vnode in array\n- >3 args: slice to array
H->>V: createVNode(type, propsOrChildren, children)
else l === 1
H->>V: createVNode(type)
end
V-->>H: vnode
H->>BT: setBlockTracking(1) (re-enable)
H-->>C: vnode
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/runtime-core/src/h.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/runtime-core/src/h.ts (2)
packages/runtime-core/src/index.ts (3)
setBlockTracking(368-368)isVNode(111-111)createVNode(111-111)packages/shared/src/general.ts (2)
isObject(53-54)isArray(39-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Redirect rules
- GitHub Check: Header rules
- GitHub Check: Pages changed
🔇 Additional comments (1)
packages/runtime-core/src/h.ts (1)
205-207: Top-level try/finally for block tracking looks goodThis simplifies control flow and guarantees re-enable on all return paths and throws.
Also applies to: 229-231
496db15 to
d834f76
Compare
Avoid creating
doCreateVNodeeach call.Summary by CodeRabbit
Refactor
Reliability
Developer Impact