Meituan-Dianping/mpvue · error

<transition-group> children must be keyed: <${name}>

Error message

<transition-group> children must be keyed: <${name}>

What it means

Fires in the transition-group render function on Weex while collecting children: a child element has a falsy key, or an internally generated key (prefixed '__vlist', produced by v-for without explicit keys). transition-group needs real, stable keys to track enter/leave/move transitions across updates; unkeyed or auto-keyed children are skipped from the transition map and this dev warning names the offending child tag.

Source

Thrown at src/platforms/weex/runtime/components/transition-group.js:52

    const map = Object.create(null)
    const prevChildren = this.prevChildren = this.children
    const rawChildren = this.$slots.default || []
    const children = this.children = []
    const transitionData = extractTransitionData(this)

    for (let i = 0; i < rawChildren.length; i++) {
      const c = rawChildren[i]
      if (c.tag) {
        if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
          children.push(c)
          map[c.key] = c
          ;(c.data || (c.data = {})).transition = transitionData
        } else if (process.env.NODE_ENV !== 'production') {
          const opts = c.componentOptions
          const name = opts
            ? (opts.Ctor.options.name || opts.tag)
            : c.tag
          warn(`<transition-group> children must be keyed: <${name}>`)
        }
      }
    }

    if (prevChildren) {
      const kept = []
      const removed = []
      prevChildren.forEach(c => {
        c.data.transition = transitionData

        // TODO: record before patch positions

        if (map[c.key]) {
          kept.push(c)
        } else {
          removed.push(c)
        }
      })

View on GitHub (pinned to 6c5d78ee04)

Solutions

  1. Give every child in the transition-group a unique static key: <div v-for="item in items" :key="item.id">
  2. Do not rely on v-for's auto-generated keys — they are insufficient for move tracking
  3. Ensure keys are unique among siblings and stable across re-renders (avoid index-based keys when items reorder)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/platforms/weex/runtime/components/transition-group.js:52 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02). Data as JSON: /api/errors/4fc84638bf79be55. Report an issue: GitHub.