Skip to content

fix(runtime-vapor): reset insertion state to avoid duplicate block inserts during non-hydration #13220

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

Open
wants to merge 2 commits into
base: vapor
Choose a base branch
from

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Apr 18, 2025

// <template>
//   <button @click="show=!show"> toggle </button>
//   <div>
//     <Comp v-if="show"/>
//   </div>
// </template>

function render(_ctx, $props, $emit, $attrs, $slots) {
  const n0 = t0()
  const n4 = t1()
  _setInsertionState(n4)
  const n1 = _createIf(() => (_ctx.show), () => {
    const n3 = _createComponent(_ctx.Comp)
    return n3
  })
  n0.$evtclick = () => (_ctx.show=!_ctx.show)
  return [n0, n4]
}

The block of n3 will be inserted twice due to the following code in both apiCreateIf.ts and component.ts

if (!isHydrating && _insertionParent) {
  insert(xxx, _insertionParent, _insertionAnchor)
}

@edison1105 edison1105 changed the title fix(runtime-vapor): reset insertion state to avoid duplicate block inserts fix(runtime-vapor): reset insertion state to avoid duplicate block inserts during non-hydration Apr 18, 2025
Copy link

netlify bot commented Apr 18, 2025

Deploy Preview for vapor-repl ready!

Name Link
🔨 Latest commit 619420c
🔍 Latest deploy log https://app.netlify.com/sites/vapor-repl/deploys/680598624ef096000876316a
😎 Deploy Preview https://deploy-preview-13220--vapor-repl.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented Apr 18, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13220

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13220

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13220

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13220

@vue/compiler-vapor

npm i https://pkg.pr.new/@vue/compiler-vapor@13220

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13220

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13220

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13220

@vue/runtime-vapor

npm i https://pkg.pr.new/@vue/runtime-vapor@13220

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13220

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13220

vue

npm i https://pkg.pr.new/vue@13220

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13220

commit: 619420c

@edison1105 edison1105 added the scope: vapor related to vapor mode label Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: vapor related to vapor mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant