Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions packages/runtime-vapor/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1027,14 +1027,25 @@ function handleSetupResult(
devRender(instance)
}
} else {
// component has a render function but no setup function
// (typically components with only a template and no state)
if (setupResult === EMPTY_OBJ && component.render) {
instance.block = callWithErrorHandling(
component.render,
instance,
ErrorCodes.RENDER_FUNCTION,
)
// component has a render function with either:
// - no setup function (components with only a template)
// - setup returning non-block state for use in render
// support setup fn and render fn co-usage for expose
if (!isBlock(setupResult) && component.render) {
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing devtoolsRawSetupState assignment for production devtools support.

The dev-only path at lines 965-966 sets instance.devtoolsRawSetupState when __DEV__ || __FEATURE_PROD_DEVTOOLS__ is true. This production code path should have the same assignment to ensure devtools work correctly in production builds with devtools enabled.

Suggestion: Add before line 979:

if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
  instance.devtoolsRawSetupState = setupResult
}
Suggested change
if (!isBlock(setupResult) && component.render) {
if (!isBlock(setupResult) && component.render) {
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
instance.devtoolsRawSetupState = setupResult
}

Copilot uses AI. Check for mistakes.
instance.setupState = proxyRefs(setupResult)
instance.block =
callWithErrorHandling(
component.render,
instance,
ErrorCodes.RENDER_FUNCTION,
[
instance.setupState,
instance.props,
instance.emit,
instance.attrs,
instance.slots,
],
) || []
} else {
// in prod result can only be block
instance.block = setupResult as Block
Expand Down
Loading