mirror of https://github.com/vuejs/core.git
fix(runtime-vapor): reset insertion state to avoid duplicate block inserts
This commit is contained in:
parent
9ab8e4c0c9
commit
684e47c848
|
@ -23,7 +23,11 @@ import type { DynamicSlot } from './componentSlots'
|
|||
import { renderEffect } from './renderEffect'
|
||||
import { VaporVForFlags } from '../../shared/src/vaporFlags'
|
||||
import { isHydrating, locateHydrationNode } from './dom/hydration'
|
||||
import { insertionAnchor, insertionParent } from './insertionState'
|
||||
import {
|
||||
insertionAnchor,
|
||||
insertionParent,
|
||||
resetInsertionState,
|
||||
} from './insertionState'
|
||||
|
||||
class ForBlock extends VaporFragment {
|
||||
scope: EffectScope | undefined
|
||||
|
@ -72,6 +76,8 @@ export const createFor = (
|
|||
const _insertionAnchor = insertionAnchor
|
||||
if (isHydrating) {
|
||||
locateHydrationNode()
|
||||
} else {
|
||||
resetInsertionState()
|
||||
}
|
||||
|
||||
let isMounted = false
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { type Block, type BlockFn, DynamicFragment, insert } from './block'
|
||||
import { isHydrating, locateHydrationNode } from './dom/hydration'
|
||||
import { insertionAnchor, insertionParent } from './insertionState'
|
||||
import {
|
||||
insertionAnchor,
|
||||
insertionParent,
|
||||
resetInsertionState,
|
||||
} from './insertionState'
|
||||
import { renderEffect } from './renderEffect'
|
||||
|
||||
export function createIf(
|
||||
|
@ -13,6 +17,8 @@ export function createIf(
|
|||
const _insertionAnchor = insertionAnchor
|
||||
if (isHydrating) {
|
||||
locateHydrationNode()
|
||||
} else {
|
||||
resetInsertionState()
|
||||
}
|
||||
|
||||
let frag: Block
|
||||
|
|
|
@ -59,7 +59,11 @@ import {
|
|||
} from './componentSlots'
|
||||
import { hmrReload, hmrRerender } from './hmr'
|
||||
import { isHydrating, locateHydrationNode } from './dom/hydration'
|
||||
import { insertionAnchor, insertionParent } from './insertionState'
|
||||
import {
|
||||
insertionAnchor,
|
||||
insertionParent,
|
||||
resetInsertionState,
|
||||
} from './insertionState'
|
||||
|
||||
export { currentInstance } from '@vue/runtime-dom'
|
||||
|
||||
|
@ -142,6 +146,8 @@ export function createComponent(
|
|||
const _insertionAnchor = insertionAnchor
|
||||
if (isHydrating) {
|
||||
locateHydrationNode()
|
||||
} else {
|
||||
resetInsertionState()
|
||||
}
|
||||
|
||||
// vdom interop enabled and component is not an explicit vapor component
|
||||
|
|
|
@ -4,7 +4,11 @@ import { rawPropsProxyHandlers } from './componentProps'
|
|||
import { currentInstance, isRef } from '@vue/runtime-dom'
|
||||
import type { LooseRawProps, VaporComponentInstance } from './component'
|
||||
import { renderEffect } from './renderEffect'
|
||||
import { insertionAnchor, insertionParent } from './insertionState'
|
||||
import {
|
||||
insertionAnchor,
|
||||
insertionParent,
|
||||
resetInsertionState,
|
||||
} from './insertionState'
|
||||
import { isHydrating, locateHydrationNode } from './dom/hydration'
|
||||
|
||||
export type RawSlots = Record<string, VaporSlot> & {
|
||||
|
@ -96,6 +100,8 @@ export function createSlot(
|
|||
const _insertionAnchor = insertionAnchor
|
||||
if (isHydrating) {
|
||||
locateHydrationNode()
|
||||
} else {
|
||||
resetInsertionState()
|
||||
}
|
||||
|
||||
const instance = currentInstance as VaporComponentInstance
|
||||
|
|
Loading…
Reference in New Issue