From f23ae6237a0fe9a951ffc79ffbb4819617f637be Mon Sep 17 00:00:00 2001 From: qiang Date: Fri, 11 Oct 2024 09:49:23 +0800 Subject: [PATCH] fix(hooks): rendering multiple popper container DOM in SSR/SSG (#18482) --- packages/hooks/use-popper-container/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/hooks/use-popper-container/index.ts b/packages/hooks/use-popper-container/index.ts index 88cbff329a..6b6047960e 100644 --- a/packages/hooks/use-popper-container/index.ts +++ b/packages/hooks/use-popper-container/index.ts @@ -3,8 +3,6 @@ import { isClient } from '@element-plus/utils' import { useGetDerivedNamespace } from '../use-namespace' import { useIdInjection } from '../use-id' -let cachedContainer: HTMLElement - export const usePopperContainerId = () => { const namespace = useGetDerivedNamespace() const idInjection = useIdInjection() @@ -37,10 +35,9 @@ export const usePopperContainer = () => { // for this we need to disable the caching since it's not really needed if ( process.env.NODE_ENV === 'test' || - !cachedContainer || !document.body.querySelector(selector.value) ) { - cachedContainer = createContainer(id.value) + createContainer(id.value) } })