8000 fix(compiler-vapor): prevent caching UpdateExpression by zhiyuanzmj · Pull Request #13346 · vuejs/core · GitHub
[go: up one dir, main page]

Skip to content

fix(compiler-vapor): prevent caching UpdateExpression #13346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 20, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat(runtime-vapor): support HMR for setup
  • Loading branch information
zhiyuanzmj committed May 11, 2025
commit 172df6a2f15f71a22e7b2a466bc6b0634aacb121
55 changes: 35 additions & 20 deletions packages/runtime-vapor/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ export function createComponent(
appContext,
)

// HMR
if (__DEV__ && component.__hmrId) {
registerHMR(instance)
instance.isSingleRoot = isSingleRoot
instance.hmrRerender = hmrRerender.bind(null, instance)
instance.hmrReload = hmrReload.bind(null, instance)
}

if (__DEV__) {
pushWarningContext(instance)
startMeasure(instance, `init`)
Expand Down Expand Up @@ -221,14 +229,6 @@ export function createComponent(
// TODO make the proxy warn non-existent property access during dev
instance.setupState = proxyRefs(setupResult)
devRender(instance)

// HMR
if (component.__hmrId) {
registerHMR(instance)
instance.isSingleRoot = isSingleRoot
instance.hmrRerender = hmrRerender.bind(null, instance)
instance.hmrReload = hmrReload.bind(null, instance)
}
}
} else {
// component has a render function but no setup function
Expand Down Expand Up @@ -283,18 +283,33 @@ export let isApplyingFallthroughProps = false
*/
export function devRender(instance: VaporComponentInstance): void {
instance.block =
callWithErrorHandling(
instance.type.render!,
instance,
ErrorCodes.RENDER_FUNCTION,
[
instance.setupState,
instance.props,
instance.emit,
instance.attrs,
instance.slots,
],
) || []
(instance.type.render
? callWithErrorHandling(
instance.type.render,
instance,
ErrorCodes.RENDER_FUNCTION,
[
instance.setupState,
instance.props,
instance.emit,
instance.attrs,
instance.slots,
],
)
: callWithErrorHandling(
isFunction(instance.type) ? instance.type : instance.type.setup!,
instance,
ErrorCodes.SETUP_FUNCTION,
[
instance.props,
{
slots: instance.slots,
attrs: instance.attrs,
emit: instance.emit,
expose: instance.expose,
},
],
)) || []
}

const emptyContext: GenericAppContext = {
Expand Down
0