修正了一个小bug

This commit is contained in:
Xu Chang 2022-11-24 17:51:19 +08:00
parent 35ee2618b6
commit d89cad87ca
4 changed files with 14 additions and 8 deletions

View File

@ -39,7 +39,7 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict, Cxt extends A
}>): Partial<ED[T]["Schema"]>[];
private getInner;
get<T extends keyof ED, S extends ED[T]['Selection']>(entity: T, selection: S, params?: SelectOption): Partial<ED[T]["Schema"]>[];
judgeRelation(entity: keyof ED, attr: string): string | 0 | 1 | 2 | string[];
judgeRelation(entity: keyof ED, attr: string): string | 0 | 2 | 1 | string[];
bindOnSync(callback: (opRecords: OpRecord<ED>[]) => void): void;
unbindOnSync(callback: (opRecords: OpRecord<ED>[]) => void): void;
getCachedData(): { [T in keyof ED]?: ED[T]["OpSchema"][] | undefined; };

View File

@ -38,7 +38,7 @@ declare abstract class Node<ED extends EntityDict & BaseEntityDict, T extends ke
setExecuting(executing: boolean): void;
getParent(): SingleNode<ED, keyof ED, Cxt, FrontCxt, AD> | ListNode<ED, T, Cxt, FrontCxt, AD> | VirtualNode<ED, Cxt, FrontCxt, AD> | undefined;
protected getProjection(): ED[T]["Selection"]["data"];
protected judgeRelation(attr: string): string | 0 | 1 | 2 | string[];
protected judgeRelation(attr: string): string | 0 | 2 | 1 | string[];
protected contains(filter: ED[T]['Selection']['filter'], conditionalFilter: ED[T]['Selection']['filter']): boolean;
protected repel(filter1: ED[T]['Selection']['filter'], filter2: ED[T]['Selection']['filter']): boolean;
}

View File

@ -192,12 +192,15 @@ function reRender(option, extra) {
features: features,
props: this.props,
})
: {
__now: Date.now(), // 如果没有任何state被set可能会不触发重渲染
};
: {};
if (extra) {
Object.assign(data, extra);
}
if (Object.keys(data).length === 0) {
Object.assign(data, {
__now: Date.now(), // 如果没有任何state被set可能会不触发重渲染
});
}
this.setState(data);
}
}

View File

@ -203,12 +203,15 @@ export function reRender<
features,
props: this.props,
} as any)
: {
__now: Date.now(), // 如果没有任何state被set可能会不触发重渲染
};
: {};
if (extra) {
Object.assign(data, extra);
}
if (Object.keys(data).length === 0) {
Object.assign(data, {
__now: Date.now(), // 如果没有任何state被set可能会不触发重渲染
})
}
this.setState(data);
}
}