fix: inheritance cache bug (#3669)
This commit is contained in:
parent
ba2467c9bf
commit
f9567d711b
@ -16,8 +16,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
protected foreignKeyFields: CollectionFieldOptions[];
|
protected foreignKeyFields: CollectionFieldOptions[];
|
||||||
|
|
||||||
getParentCollectionsName() {
|
getParentCollectionsName() {
|
||||||
if (this.parentCollectionsName?.length) {
|
if (this.parentCollectionsName) {
|
||||||
return this.parentCollectionsName;
|
return this.parentCollectionsName.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
const parents: string[] = [];
|
const parents: string[] = [];
|
||||||
@ -41,8 +41,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getParentCollections() {
|
getParentCollections() {
|
||||||
if (this.parentCollections?.length) {
|
if (this.parentCollections) {
|
||||||
return this.parentCollections;
|
return this.parentCollections.slice();
|
||||||
}
|
}
|
||||||
this.parentCollections = this.getParentCollectionsName().map((collectionName) => {
|
this.parentCollections = this.getParentCollectionsName().map((collectionName) => {
|
||||||
return this.collectionManager.getCollection(collectionName);
|
return this.collectionManager.getCollection(collectionName);
|
||||||
@ -52,8 +52,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
|
|
||||||
getChildrenCollectionsName(isSupportView = false) {
|
getChildrenCollectionsName(isSupportView = false) {
|
||||||
const cacheKey = isSupportView ? 'supportView' : 'notSupportView';
|
const cacheKey = isSupportView ? 'supportView' : 'notSupportView';
|
||||||
if (this.childrenCollectionsName[cacheKey]?.length) {
|
if (this.childrenCollectionsName[cacheKey]) {
|
||||||
return this.childrenCollectionsName[cacheKey];
|
return this.childrenCollectionsName[cacheKey].slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
const children: string[] = [];
|
const children: string[] = [];
|
||||||
@ -86,8 +86,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
|
|
||||||
getChildrenCollections(isSupportView = false) {
|
getChildrenCollections(isSupportView = false) {
|
||||||
const cacheKey = isSupportView ? 'supportView' : 'notSupportView';
|
const cacheKey = isSupportView ? 'supportView' : 'notSupportView';
|
||||||
if (this.childrenCollections[cacheKey]?.length) {
|
if (this.childrenCollections[cacheKey]) {
|
||||||
return this.childrenCollections[cacheKey];
|
return this.childrenCollections[cacheKey].slice();
|
||||||
}
|
}
|
||||||
this.childrenCollections[cacheKey] = this.getChildrenCollectionsName(isSupportView).map((collectionName) => {
|
this.childrenCollections[cacheKey] = this.getChildrenCollectionsName(isSupportView).map((collectionName) => {
|
||||||
return this.collectionManager.getCollection(collectionName);
|
return this.collectionManager.getCollection(collectionName);
|
||||||
@ -96,8 +96,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInheritedFields() {
|
getInheritedFields() {
|
||||||
if (this.inheritsFields?.length) {
|
if (this.inheritsFields) {
|
||||||
return this.inheritsFields;
|
return this.inheritsFields.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentCollections = this.getParentCollectionsName();
|
const parentCollections = this.getParentCollectionsName();
|
||||||
@ -155,8 +155,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAllCollectionsInheritChain() {
|
getAllCollectionsInheritChain() {
|
||||||
if (this.allCollectionsInheritChain?.length) {
|
if (this.allCollectionsInheritChain) {
|
||||||
return this.allCollectionsInheritChain;
|
return this.allCollectionsInheritChain.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
const collectionsInheritChain = [this.name];
|
const collectionsInheritChain = [this.name];
|
||||||
@ -197,8 +197,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInheritCollectionsChain() {
|
getInheritCollectionsChain() {
|
||||||
if (this.inheritCollectionsChain?.length) {
|
if (this.inheritCollectionsChain) {
|
||||||
return this.inheritCollectionsChain;
|
return this.inheritCollectionsChain.slice();
|
||||||
}
|
}
|
||||||
const collectionsInheritChain = [this.name];
|
const collectionsInheritChain = [this.name];
|
||||||
const getInheritChain = (name: string) => {
|
const getInheritChain = (name: string) => {
|
||||||
@ -225,8 +225,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAllFields(predicate?: GetCollectionFieldPredicate) {
|
getAllFields(predicate?: GetCollectionFieldPredicate) {
|
||||||
if (this.allFields?.length) {
|
if (this.allFields) {
|
||||||
return this.allFields;
|
return this.allFields.slice();
|
||||||
}
|
}
|
||||||
const currentFields = this.getCurrentFields();
|
const currentFields = this.getCurrentFields();
|
||||||
const inheritedFields = this.getInheritedFields();
|
const inheritedFields = this.getInheritedFields();
|
||||||
@ -240,8 +240,8 @@ export class InheritanceCollectionMixin extends Collection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getForeignKeyFields() {
|
getForeignKeyFields() {
|
||||||
if (this.foreignKeyFields?.length) {
|
if (this.foreignKeyFields) {
|
||||||
return this.foreignKeyFields;
|
return this.foreignKeyFields.slice();
|
||||||
}
|
}
|
||||||
const currentFields = this.getCurrentFields();
|
const currentFields = this.getCurrentFields();
|
||||||
const inheritedFields = this.getInheritedFields();
|
const inheritedFields = this.getInheritedFields();
|
||||||
|
Loading…
Reference in New Issue
Block a user