{"record":{"id":"4e54c68304b544ef","repo":"Meituan-Dianping/mpvue","slug":"duplicate-presence-of-slot-name-found-in-the","errorCode":null,"errorMessage":"Duplicate presence of slot \"${name}\" found in the same render tree - this will likely cause render errors.","messagePattern":"Duplicate presence of slot \"(.+?)\" found in the same render tree - this will likely cause render errors\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/weex-vue-framework/factory.js","lineNumber":3857,"sourceCode":" */\nfunction renderSlot (\n  name,\n  fallback,\n  props,\n  bindObject\n) {\n  var scopedSlotFn = this.$scopedSlots[name];\n  if (scopedSlotFn) { // scoped slot\n    props = props || {};\n    if (bindObject) {\n      props = extend(extend({}, bindObject), props);\n    }\n    return scopedSlotFn(props) || fallback\n  } else {\n    var slotNodes = this.$slots[name];\n    // warn duplicate slot usage\n    if (slotNodes && process.env.NODE_ENV !== 'production') {\n      slotNodes._rendered && warn(\n        \"Duplicate presence of slot \\\"\" + name + \"\\\" found in the same render tree \" +\n        \"- this will likely cause render errors.\",\n        this\n      );\n      slotNodes._rendered = true;\n    }\n    return slotNodes || fallback\n  }\n}\n\n/*  */\n\n/**\n * Runtime helper for resolving filters\n */\nfunction resolveFilter (id) {\n  return resolveAsset(this.$options, 'filters', id, true) || identity\n}","sourceCodeStart":3839,"sourceCodeEnd":3875,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/packages/weex-vue-framework/factory.js#L3839-L3875","documentation":"Slot content vnodes are memoized with a `_rendered` flag; `$slots`/`renderSlot` checks it before re-rendering. If the same named slot's vnodes appear twice in one render tree, the second use triggers this warning because reusing the same vnode instances in multiple places corrupts the patch.","triggerScenarios":"Referencing the same `<slot name=\"x\">` (or `<slot>` default) twice within a component's template; wrapping a component that renders a slot and also rendering the slot again in the same parent; conditional branches in the same tree both consuming the same slot nodes.","commonSituations":"Layout components rendering a header slot in both a desktop and a mobile branch; a component that clones itself (e.g. tooltip + inline render) each consuming the parent slot; HOCs double-rendering children.","solutions":["Render each named slot only once per component template; restructure so the slot content appears in a single place.","If the content must appear twice, use a scoped slot or render the content via a method that creates fresh vnodes each call.","Duplicate the slot usage in the parent: pass the same markup through two distinct slots.","Clone vnodes explicitly with `cloneVNode` if you truly need the same content in two places."],"exampleFix":"// before\n<header><slot name=\"title\"/></header>\n<footer><slot name=\"title\"/></footer>\n// after\n<header><slot name=\"title\"/></header>\n<footer><slot name=\"footerTitle\"/></footer>","handlingStrategy":"validation","validationCode":"// in dev, detect a slot consumed more than once in the same component\nconst used = new Set();\nfunction useSlotOnce(name) {\n  if (used.has(name)) console.warn(`slot \"${name}\" rendered twice`);\n  used.add(name);\n  return this.$slots[name];\n}","typeGuard":"function slotAlreadyRendered(slotNodes) {\n  return !!slotNodes || (slotNodes && slotNodes._rendered === true);\n}","tryCatchPattern":null,"preventionTips":["Render each named slot exactly once per template.","Use scoped slots or cloneVNode when the same content must appear twice.","Audit HOC/wrapper components for double slot consumption."],"tags":["vue","slots","vdom","dev-warning"],"backgroundTag":"duplicate-slot-render","analyzedSha":"6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b","analyzedAt":"2026-09-02T05:17:40.946Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}