fix(runtime-core): avoid scopeId as attr for slot nodes with same scopeId (#1561)
fix vitejs/vite#536
This commit is contained in:
		
							parent
							
								
									2b60870f8a
								
							
						
					
					
						commit
						583a1c7b45
					
				@ -166,12 +166,16 @@ export function renderComponentRoot(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // inherit scopeId
 | 
					    // inherit scopeId
 | 
				
			||||||
    const scopeId = vnode.scopeId
 | 
					    const scopeId = vnode.scopeId
 | 
				
			||||||
 | 
					    // vite#536: if subtree root is created from parent slot if would already
 | 
				
			||||||
 | 
					    // have the correct scopeId, in this case adding the scopeId will cause
 | 
				
			||||||
 | 
					    // it to be removed if the original slot vnode is reused.
 | 
				
			||||||
 | 
					    const needScopeId = scopeId && root.scopeId !== scopeId
 | 
				
			||||||
    const treeOwnerId = parent && parent.type.__scopeId
 | 
					    const treeOwnerId = parent && parent.type.__scopeId
 | 
				
			||||||
    const slotScopeId =
 | 
					    const slotScopeId =
 | 
				
			||||||
      treeOwnerId && treeOwnerId !== scopeId ? treeOwnerId + '-s' : null
 | 
					      treeOwnerId && treeOwnerId !== scopeId ? treeOwnerId + '-s' : null
 | 
				
			||||||
    if (scopeId || slotScopeId) {
 | 
					    if (needScopeId || slotScopeId) {
 | 
				
			||||||
      const extras: Data = {}
 | 
					      const extras: Data = {}
 | 
				
			||||||
      if (scopeId) extras[scopeId] = ''
 | 
					      if (needScopeId) extras[scopeId] = ''
 | 
				
			||||||
      if (slotScopeId) extras[slotScopeId] = ''
 | 
					      if (slotScopeId) extras[slotScopeId] = ''
 | 
				
			||||||
      root = cloneVNode(root, extras)
 | 
					      root = cloneVNode(root, extras)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user