From c0573b9f7c3f5e1a7dc2f58cc489fb958c624398 Mon Sep 17 00:00:00 2001 From: Rainke Date: Wed, 1 Nov 2023 10:37:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20import=20schema=20=E4=B9=8B=E5=90=8E=20c?= =?UTF-8?q?ache=20=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF(#2596)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/renderer-core/src/hoc/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/renderer-core/src/hoc/index.tsx b/packages/renderer-core/src/hoc/index.tsx index 3e7f5ec6a..4851ea486 100644 --- a/packages/renderer-core/src/hoc/index.tsx +++ b/packages/renderer-core/src/hoc/index.tsx @@ -49,7 +49,7 @@ function patchDidCatch(Comp: any, { baseRenderer }: Options) { } } -const cache = new Map(); +const cache = new Map(); export function compWrapper(Comp: any, options: Options) { const { createElement, Component, forwardRef } = adapter.getRuntime(); @@ -62,8 +62,8 @@ export function compWrapper(Comp: any, options: Options) { return Comp; } - if (cache.has(options.schema.id)) { - return cache.get(options.schema.id); + if (cache.has(options.schema.id) && cache.get(options.schema.id)?.Comp === Comp) { + return cache.get(options.schema.id)?.WrapperComponent; } class Wrapper extends Component { @@ -82,7 +82,7 @@ export function compWrapper(Comp: any, options: Options) { Comp, ); - cache.set(options.schema.id, WrapperComponent); + cache.set(options.schema.id, { WrapperComponent, Comp }); return WrapperComponent; }