Skip to content

Commit 85d6f11

Browse files
committed
ensure instance-unique keys for <transition> child nodes during pending node removal (fix #4702)
1 parent c66991d commit 85d6f11

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/platforms/web/runtime/components/transition.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,13 @@ export default {
127127
return placeholder(h, rawChild)
128128
}
129129

130-
const key = child.key = child.key == null || child.isStatic
131-
? `__v${child.tag + this._uid}__`
132-
: child.key
130+
// ensure a key that is unique to the vnode type and to this transition
131+
// component instance. This key will be used to remove pending leaving nodes
132+
// during entering.
133+
const id = `__transition-${this._uid}-`
134+
const key = child.key = child.key == null
135+
? id + child.tag
136+
: child.key.indexOf(id) === 0 ? child.key : id + child.key
133137
const data = (child.data || (child.data = {})).transition = extractTransitionData(this)
134138
const oldRawChild = this._vnode
135139
const oldChild: any = getRealChild(oldRawChild)

src/platforms/web/runtime/modules/transition.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export function enter (vnode: VNodeWithData, toggleDisplay: ?() => void) {
103103
const parent = el.parentNode
104104
const pendingNode = parent && parent._pending && parent._pending[vnode.key]
105105
if (pendingNode &&
106-
pendingNode.context === vnode.context &&
107106
pendingNode.tag === vnode.tag &&
108107
pendingNode.elm._leaveCb) {
109108
pendingNode.elm._leaveCb()

0 commit comments

Comments
 (0)