mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
fix: type error
This commit is contained in:
parent
aa4ea33698
commit
d9ad97fb17
@ -58,7 +58,10 @@ export class FlowModel<Structure extends { parent?: any; subModels?: any } = Def
|
||||
* 基于 key 的 fork 实例缓存,用于复用 fork 实例
|
||||
*/
|
||||
private forkCache: Map<string, ForkFlowModel<any>> = new Map();
|
||||
// model 树的共享运行上下文
|
||||
|
||||
/**
|
||||
* model 树的共享运行上下文
|
||||
*/
|
||||
private _sharedContext: Record<string, any> = {};
|
||||
|
||||
constructor(options: FlowModelOptions<Structure>) {
|
||||
|
@ -39,7 +39,7 @@ export class ForkFlowModel<TMaster extends FlowModel = FlowModel> {
|
||||
public readonly forkId: number;
|
||||
|
||||
/** 用于共享上下文的对象,存储跨 fork 的共享数据 */
|
||||
private _sharedContext: Record<string, any> = {};
|
||||
// private _sharedContext: Record<string, any> = {};
|
||||
|
||||
constructor(master: TMaster, initialProps: IModelComponentProps = {}, forkId = 0) {
|
||||
this.master = master;
|
||||
@ -121,16 +121,16 @@ export class ForkFlowModel<TMaster extends FlowModel = FlowModel> {
|
||||
}
|
||||
|
||||
public setSharedContext(ctx: Record<string, any>) {
|
||||
this._sharedContext = ctx;
|
||||
this['_sharedContext'] = ctx;
|
||||
}
|
||||
|
||||
public getSharedContext() {
|
||||
if (this.async || !this.parent) {
|
||||
return this._sharedContext;
|
||||
return this['_sharedContext'] || {};
|
||||
}
|
||||
return {
|
||||
...this.parent?.getSharedContext(),
|
||||
...this._sharedContext, // 当前实例的 context 优先级最高
|
||||
...this['_sharedContext'], // 当前实例的 context 优先级最高
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user