Skip to content

Commit 95a48e0

Browse files
rainkeJackLian
authored andcommitted
fix: import schema 之后 cache 判断错误(#2596)
1 parent b3b2a03 commit 95a48e0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/renderer-core/src/hoc/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function patchDidCatch(Comp: any, { baseRenderer }: Options) {
4949
}
5050
}
5151

52-
const cache = new Map();
52+
const cache = new Map<string, { Comp: any; WrapperComponent: any }>();
5353

5454
export function compWrapper(Comp: any, options: Options) {
5555
const { createElement, Component, forwardRef } = adapter.getRuntime();
@@ -62,8 +62,8 @@ export function compWrapper(Comp: any, options: Options) {
6262
return Comp;
6363
}
6464

65-
if (cache.has(options.schema.id)) {
66-
return cache.get(options.schema.id);
65+
if (cache.has(options.schema.id) && cache.get(options.schema.id)?.Comp === Comp) {
66+
return cache.get(options.schema.id)?.WrapperComponent;
6767
}
6868

6969
class Wrapper extends Component {
@@ -82,7 +82,7 @@ export function compWrapper(Comp: any, options: Options) {
8282
Comp,
8383
);
8484

85-
cache.set(options.schema.id, WrapperComponent);
85+
cache.set(options.schema.id, { WrapperComponent, Comp });
8686

8787
return WrapperComponent;
8888
}

0 commit comments

Comments
 (0)