mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
fix: import schema 之后 cache 判断错误(#2596)
This commit is contained in:
parent
b3b2a03642
commit
95a48e057f
@ -49,7 +49,7 @@ function patchDidCatch(Comp: any, { baseRenderer }: Options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cache = new Map();
|
const cache = new Map<string, { Comp: any; WrapperComponent: any }>();
|
||||||
|
|
||||||
export function compWrapper(Comp: any, options: Options) {
|
export function compWrapper(Comp: any, options: Options) {
|
||||||
const { createElement, Component, forwardRef } = adapter.getRuntime();
|
const { createElement, Component, forwardRef } = adapter.getRuntime();
|
||||||
@ -62,8 +62,8 @@ export function compWrapper(Comp: any, options: Options) {
|
|||||||
return Comp;
|
return Comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache.has(options.schema.id)) {
|
if (cache.has(options.schema.id) && cache.get(options.schema.id)?.Comp === Comp) {
|
||||||
return cache.get(options.schema.id);
|
return cache.get(options.schema.id)?.WrapperComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Wrapper extends Component {
|
class Wrapper extends Component {
|
||||||
@ -82,7 +82,7 @@ export function compWrapper(Comp: any, options: Options) {
|
|||||||
Comp,
|
Comp,
|
||||||
);
|
);
|
||||||
|
|
||||||
cache.set(options.schema.id, WrapperComponent);
|
cache.set(options.schema.id, { WrapperComponent, Comp });
|
||||||
|
|
||||||
return WrapperComponent;
|
return WrapperComponent;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user